public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: Rolf Eike Beer <eike-kernel@sf-tec.de>
To: "Moger, Babu" <Babu.Moger@lsi.com>
Cc: Hillf Danton <dhillf@gmail.com>,
	"linux-scsi@vger.kernel.org" <linux-scsi@vger.kernel.org>,
	Chandra Seetharaman <chandra.seetharaman@us.ibm.com>
Subject: Re: [PATCH] fix kzalloc in scsi device handler
Date: Tue, 16 Nov 2010 18:35:48 +0100	[thread overview]
Message-ID: <201011161835.49079.eike-kernel@sf-tec.de> (raw)
In-Reply-To: <E463DF2B2E584B4A82673F53D62C2EF4F51A7EDA@cosmail01.lsi.com>

[-- Attachment #1: Type: Text/Plain, Size: 1571 bytes --]

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@vger.kernel.org [mailto:linux-scsi-
> > owner@vger.kernel.org] On Behalf Of Hillf Danton
> > Sent: Tuesday, November 16, 2010 7:34 AM
> > To: linux-scsi@vger.kernel.org
> > 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@gmail.com>
> > ---
> > 
> > --- 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 #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

  reply	other threads:[~2010-11-16 17:42 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-16 13:34 [PATCH] fix kzalloc in scsi device handler Hillf Danton
2010-11-16 16:15 ` Moger, Babu
2010-11-16 17:35   ` Rolf Eike Beer [this message]
2010-11-16 18:57     ` Moger, Babu
2010-11-16 19:17       ` Rolf Eike Beer
2010-11-16 19:23         ` Moger, Babu
2010-11-17 10:04     ` Boaz Harrosh
2010-11-17 13:16       ` Hillf Danton

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201011161835.49079.eike-kernel@sf-tec.de \
    --to=eike-kernel@sf-tec.de \
    --cc=Babu.Moger@lsi.com \
    --cc=chandra.seetharaman@us.ibm.com \
    --cc=dhillf@gmail.com \
    --cc=linux-scsi@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox