Re: [PATCH] fix kzalloc in scsi device handler

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Moger, Babu wrote:
> Agree.. But this may not fix the problem completely.. Please see my
> comments below.. Also copied Chandra if he has any comments..
> 
> > -----Original Message-----
> > From: linux-scsi-owner@xxxxxxxxxxxxxxx [mailto:linux-scsi-
> > owner@xxxxxxxxxxxxxxx] On Behalf Of Hillf Danton
> > Sent: Tuesday, November 16, 2010 7:34 AM
> > To: linux-scsi@xxxxxxxxxxxxxxx
> > Subject: [PATCH] fix kzalloc in scsi device handler
> > 
> > They look like typo, since there are four instances of kzalloc almost
> > typed by the same finger.
> > 
> > The pointer is replaced with a struct, which helps kzalloc return
> > correct result.
> > 
> > thanks for any comment on the possibility that mem overflow could
> > happen.
> > 
> > Signed-off-by: Hillf Danton <dhillf@xxxxxxxxx>
> > ---
> > 
> > --- a/drivers/scsi/device_handler/scsi_dh_alua.c	2010-11-01
> > 19:54:12.000000000 +0800
> > +++ b/drivers/scsi/device_handler/scsi_dh_alua.c	2010-11-16
> > 20:40:36.000000000 +0800
> > @@ -759,7 +759,7 @@ static int alua_bus_attach(struct scsi_d
> > 
> >  	unsigned long flags;
> >  	int err = SCSI_DH_OK;
> > 
> > -	scsi_dh_data = kzalloc(sizeof(struct scsi_device_handler *)
> > +	scsi_dh_data = kzalloc(sizeof(struct scsi_dh_data)
> > 
> >  			       + sizeof(*h) , GFP_KERNEL);
> 
> I think this should be like this below.
> 
>       scsi_dh_data = kzalloc(sizeof(struct scsi_dh_data)
>   			       + sizeof(struct alua_dh_data) , GFP_KERNEL);

How about kzalloc(sizeof(*scsi_dh_data) + sizeof(*h), GFP_KERNEL)?

Eike

Attachment: signature.asc
Description: This is a digitally signed message part.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]
  Powered by Linux