Re: [PATCH 30] drivers/ide/arm/icside.c: kmalloc + memset conversion to kzalloc

From: Bartlomiej Zolnierkiewicz
Date: Wed Aug 01 2007 - 17:04:45 EST


On Tuesday 31 July 2007, Mariusz Kozlowski wrote:
> Is this a bug? In original verison memset cleared sizeof(state) bytes
> instead of sizeof(*state). If it was intentional then this patch is invalid.
> If not intentional -> valid :) Please review.

Yes, it is a bug so this patch is a valid bugfix. :-)

> Signed-off-by: Mariusz Kozlowski <m.kozlowski@xxxxxxxxxx>

> drivers/ide/arm/icside.c | 18883 -> 18849 (-34 bytes)
>
> drivers/ide/arm/icside.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)

applied

> --- linux-2.6.23-rc1-mm1-a/drivers/ide/arm/icside.c 2007-07-26 13:07:41.000000000 +0200
> +++ linux-2.6.23-rc1-mm1-b/drivers/ide/arm/icside.c 2007-07-31 11:32:27.000000000 +0200
> @@ -682,13 +682,12 @@ icside_probe(struct expansion_card *ec,
> if (ret)
> goto out;
>
> - state = kmalloc(sizeof(struct icside_state), GFP_KERNEL);
> + state = kzalloc(sizeof(struct icside_state), GFP_KERNEL);
> if (!state) {
> ret = -ENOMEM;
> goto release;
> }
>
> - memset(state, 0, sizeof(state));
> state->type = ICS_TYPE_NOTYPE;
> state->dev = &ec->dev;
>
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/