Re: [PATCH 24/54] md/raid1: Improve another size determination in setup_conf()

From: Dan Carpenter
Date: Wed Oct 12 2016 - 04:29:51 EST


foo = kmalloc(sizeof(*foo), GFP_KERNEL);

This says you are allocating enough space for foo. It can be reviewed
by looking at one line. If you change the type of foo it will still

foo = kmalloc(sizeof(struct whatever), GFP_KERNEL);

There isn't enough information to say if this is correct. If you change
the type of foo then you have to update the allocation as well.

It's not a super common type of bug, but I see it occasionally.

dan carpenter