2
0
mirror of https://github.com/edk2-porting/linux-next.git synced 2024-12-26 22:24:09 +08:00

staging: comedi: comedi_fops: use kzalloc in comedi_alloc_subdevice_minor()

The hardware_device member of comedi_file_info is not set in this
function. Use kzalloc to make sure this pointer does not contain
invalid data.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
H Hartley Sweeten 2012-12-19 15:45:34 -07:00 committed by Greg Kroah-Hartman
parent a52840a98b
commit 71cf6d3ee9

View File

@ -2376,8 +2376,8 @@ int comedi_alloc_subdevice_minor(struct comedi_device *dev,
struct device *csdev; struct device *csdev;
unsigned i; unsigned i;
info = kmalloc(sizeof(*info), GFP_KERNEL); info = kzalloc(sizeof(*info), GFP_KERNEL);
if (info == NULL) if (!info)
return -ENOMEM; return -ENOMEM;
info->device = dev; info->device = dev;
info->read_subdevice = s; info->read_subdevice = s;