All of lore.kernel.org
 help / color / mirror / Atom feed
From: walter harms <wharms@bfs.de>
To: kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] [SCSI] pm8001: Add error handler in pm8001_init_sas_add() if kzalloc fails.
Date: Wed, 21 Mar 2012 10:50:00 +0000	[thread overview]
Message-ID: <4F69B258.9020906@bfs.de> (raw)
In-Reply-To: <1332319785.2909.11.camel@dabdike.int.hansenpartnership.com>



Am 21.03.2012 11:11, schrieb James Bottomley:
> On Wed, 2012-03-21 at 11:58 +0300, Dan Carpenter wrote:
>> On Wed, Mar 21, 2012 at 08:49:45AM +0000, James Bottomley wrote:
>>> On Wed, 2012-03-21 at 14:08 +0530, santosh nayak wrote:
>>>> From: Santosh Nayak <santoshprasadnayak@gmail.com>
>>>>
>>>> We need to add error handler if kzalloc fails to allocate and initialize.
>>>> Otherwise it may lead to Null derefernce error in 
>>>> 'pm8001_chip_get_nvmd_req()'.
>>>
>>> It's a GFP_KERNEL allocation.  They sleep until memory is available
>>> (__GFP_WAIT).  It's GFP_ATOMIC that can return NULL.
>>>
>>
>> That's not right at all.  Only __GFP_NOFAIL allocations don't need
>> to be checked.
> 
> Ah, right, that's the option I was thinking of.  __GFP_WAIT may fail if
> we're in direct reclaim or the oom killer gets activated.
> 

I think it is ok to do it anytime. It is useles in the __GFP_NOFAIL case,
but it is more easy to check: avoid exceptions from the rule !

re,
 wh

  parent reply	other threads:[~2012-03-21 10:50 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-21  8:38 [PATCH] [SCSI] pm8001: Add error handler in pm8001_init_sas_add() if kzalloc fails santosh nayak
2012-03-21  8:50 ` santosh nayak
2012-03-21  8:49 ` James Bottomley
2012-03-21  8:58   ` Dan Carpenter
2012-03-21  8:58     ` Dan Carpenter
2012-03-21 10:11     ` James Bottomley
2012-03-21 10:50   ` walter harms [this message]
2012-03-21 11:06   ` Dan Carpenter
2012-03-21 17:11 ` Mark Salyzyn
2012-03-21 17:11   ` Mark Salyzyn
2012-03-22  1:49 ` Jack Wang
2012-03-22  1:49   ` Jack Wang

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=4F69B258.9020906@bfs.de \
    --to=wharms@bfs.de \
    --cc=kernel-janitors@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.