[tyndur-devel] [PATCH 11/22] ata: Initialize ata_device to 0
Max Reitz ·
* struct ata_device inherits cdi_storage_device or cdi_scsi_device. Since this driver does not know all of the fields contained therein for sure, the object has to be initialized to 0. Signed-off-by: Max Reitz <max at tyndur.org> Acked-by: Kevin Wolf <kevin at tyndur.org> --- src/modules/cdi/ata/device.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/cdi/ata/device.c b/src/modules/cdi/ata/device.c index baedd72..db47832 100644 --- a/src/modules/cdi/ata/device.c +++ b/src/modules/cdi/ata/device.c @@ -222,7 +222,7 @@ void ata_init_controller(struct ata_controller* controller) // Jetzt werden die einzelnen geraete identifiziert. Hier ist es // anscheinend geschickter mit dem Slave zu beginnen. for (i = 1; i >= 0; i--) { - struct ata_device* dev = malloc(sizeof(*dev)); + struct ata_device* dev = calloc(1, sizeof(*dev)); dev->controller = controller; dev->id = i; dev->partition_list = cdi_list_create(); -- 2.6.3