mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jesper Juhl <jesper.juhl@gmail.com>
To: "Miller, Mike (OS Dev)" <Mike.Miller@hp.com>
Cc: linux-kernel <linux-kernel@vger.kernel.org>,
	Andrew Morton <akpm@osdl.org>, Len Brown <len.brown@intel.com>,
	ISS StorageDev <iss_storagedev@hp.com>,
	Jakub Jelinek <jj@ultra.linux.cz>,
	Frodo Looijaard <frodol@dds.nl>,
	Jean Delvare <khali@linux-fr.org>,
	Bartlomiej Zolnierkiewicz <B.Zolnierkiewicz@elka.pw.edu.pl>,
	Jens Axboe <axboe@suse.de>, Roland Dreier <rolandd@cisco.com>,
	Sergio Rozanski Filho <aris@cathedrallabs.org>,
	Benjamin Herrenschmidt <benh@kernel.crashing.org>,
	Pierre Ossman <drzeus-wbsd@drzeus.cx>,
	Carsten Gross <carsten@sol.wh-hms.uni-ulm.de>,
	Greg Kroah-Hartman <greg@kroah.com>,
	David Hinds <dahinds@users.sourceforge.net>,
	Vinh Truong <vinh.truong@eng.sun.com>,
	Mark Douglas Corner <mcorner@umich.edu>,
	Michael Downey <downey@zymeta.com>,
	Antonino Daplas <adaplas@pol.net>,
	Ben Gardner <bgardner@wabtec.com>
Subject: Re: [PATCH 09/14] Big kfree NULL check cleanup - misc remaining drivers
Date: Thu, 13 Oct 2005 22:10:25 +0200	[thread overview]
Message-ID: <9a8748490510131310y2c31ac04w4ea34ee2333f7ff7@mail.gmail.com> (raw)
In-Reply-To: <D4CFB69C345C394284E4B78B876C1CF10AF98879@cceexc23.americas.cpqcorp.net>

On 10/13/05, Miller, Mike (OS Dev) <Mike.Miller@hp.com> wrote:
> > From: Jesper Juhl [mailto:jesper.juhl@gmail.com]
> > This is the remaining misc drivers/ part of the big kfree
> > cleanup patch.
> >
> > Remove pointless checks for NULL prior to calling kfree() in
> > misc files in drivers/.
> >
> >
> > --- linux-2.6.14-rc4-orig/drivers/block/cciss.c
> > 2005-10-11 22:41:05.000000000 +0200
> > +++ linux-2.6.14-rc4/drivers/block/cciss.c    2005-10-12
> > 17:43:18.000000000 +0200
> > @@ -1096,14 +1096,11 @@ static int cciss_ioctl(struct inode *ino
> >  cleanup1:
> >               if (buff) {
> >                       for(i=0; i<sg_used; i++)
> > -                             if(buff[i] != NULL)
> > -                                     kfree(buff[i]);
>
> I'm not sure I agree that these are pointless checks. They're not in the
> main code path so nothing is lost by checking first. What if the pointer
> is NULL????
>

If the pointer is NULL then this bit of code in kfree takes care of things :

 void kfree(const void *objp)
 {
...

         if (unlikely(!objp))
                 return;
...

Runtime behaviour is exactely the same.
kfree checks if the pointer passed to it is NULL in any case and just
returns if it is.


--
Jesper Juhl <jesper.juhl@gmail.com>
Don't top-post  http://www.catb.org/~esr/jargon/html/T/top-post.html
Plain text mails only, please      http://www.expita.com/nomime.html

  reply	other threads:[~2005-10-13 20:10 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-10-13 20:01 Miller, Mike (OS Dev)
2005-10-13 20:10 ` Jesper Juhl [this message]
2005-10-13 20:12 ` Roland Dreier
2005-10-13 20:30 ` Alistair John Strachan
  -- strict thread matches above, loose matches on Subject: below --
2005-10-13 20:39 Miller, Mike (OS Dev)
2005-10-13 20:03 Brown, Len
2005-10-13 19:28 Jesper Juhl
2005-10-13 19:37 ` Roland Dreier
2005-10-14  4:54 ` Pierre Ossman
2005-10-14  9:24 ` Jean Delvare
2005-10-14  9:46   ` Andrew Morton
2005-10-14 11:58   ` Jesper Juhl
2005-10-14  9:46 ` Jens Axboe
2005-10-14 18:12 ` Greg KH
2005-10-14 21:24 ` Antonino A. Daplas

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=9a8748490510131310y2c31ac04w4ea34ee2333f7ff7@mail.gmail.com \
    --to=jesper.juhl@gmail.com \
    --cc=B.Zolnierkiewicz@elka.pw.edu.pl \
    --cc=Mike.Miller@hp.com \
    --cc=adaplas@pol.net \
    --cc=akpm@osdl.org \
    --cc=aris@cathedrallabs.org \
    --cc=axboe@suse.de \
    --cc=benh@kernel.crashing.org \
    --cc=bgardner@wabtec.com \
    --cc=carsten@sol.wh-hms.uni-ulm.de \
    --cc=dahinds@users.sourceforge.net \
    --cc=downey@zymeta.com \
    --cc=drzeus-wbsd@drzeus.cx \
    --cc=frodol@dds.nl \
    --cc=greg@kroah.com \
    --cc=iss_storagedev@hp.com \
    --cc=jj@ultra.linux.cz \
    --cc=khali@linux-fr.org \
    --cc=len.brown@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mcorner@umich.edu \
    --cc=rolandd@cisco.com \
    --cc=vinh.truong@eng.sun.com \
    /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

all inboxes | Powered by JetHome®