summaryrefslogtreecommitdiff
path: root/config
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2015-03-21 15:21:14 -0700
committerAlan Coopersmith <alan.coopersmith@oracle.com>2015-04-21 16:57:07 -0700
commitb96dc999968320ad6322b50c79d847efcfcd02b2 (patch)
tree6b5f1853a7b7c4fc4bd9387dbc3d5caf0b386368 /config
parentf3ba909753cd216fc9eca4618a76cc283ccbf51e (diff)
Add XNFcallocarray() to allow xnfcalloc() to check for overflow
The xnfcalloc() macro took two arguments but simply multiplied them together without checking for overflow and defeating any overflow checking that calloc() might have done. Let's not do that. The original XNFcalloc() function is left for now to preserve driver ABI, but is marked as deprecated so it can be removed in a future round of ABI break/cleanup. Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Matt Turner <mattst88@gmail.com>
Diffstat (limited to 'config')
-rw-r--r--config/config.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/config/config.c b/config/config.c
index b5d634b87..de45cc350 100644
--- a/config/config.c
+++ b/config/config.c
@@ -130,7 +130,8 @@ device_is_duplicate(const char *config_info)
struct OdevAttributes *
config_odev_allocate_attributes(void)
{
- struct OdevAttributes *attribs = XNFcalloc(sizeof (struct OdevAttributes));
+ struct OdevAttributes *attribs =
+ xnfcalloc(1, sizeof (struct OdevAttributes));
attribs->fd = -1;
return attribs;
}