public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
From: "Bojan Smojver" <bojan@rexursive.com>
To: kernel-janitors@vger.kernel.org
Subject: Re: [patch] PM / Hibernate: NULL dereferences on error paths
Date: Sat, 08 Oct 2011 13:11:23 +0000	[thread overview]
Message-ID: <4543687634.1002586283@rexursive.com> (raw)
In-Reply-To: <20111007132453.GA31424@elgon.mountain>

------- Original message -------
> From: Dan Carpenter
> Sent: 8.10.'11,  21:51
>
> On Sat, Oct 08, 2011 at 09:28:48PM +1100, Bojan Smojver wrote:
>> +out_clean:
>> + if (data) {
>> +  for (thr = 0; thr < nr_threads; thr++) {
>> +   if (data[thr].thr)
>> +    kthread_stop(data[thr].thr);
>> +  }
>> +  vfree(data);
>> + }
>> + if (page) free_page((unsigned long)page);
>>
>
> This obviously works, but why don't you use a normal kernel unwind
> style?  You tried this complicated error handling before and it
> already caused bugs...  It's simpler if the error handling code has
> no if statements.

With the introduction of threads, there were so many unwind places, that I 
thought I may forget something in some of them, therefore causing different 
bugs. So, I put everything under out_clean, so it's all done in one place. 
Obviously, everything's a trade-off in life. :-)

--
Bojan 

  parent reply	other threads:[~2011-10-08 13:11 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-07 13:24 [patch] PM / Hibernate: NULL dereferences on error paths Dan Carpenter
2011-10-07 20:58 ` Bojan Smojver
2011-10-08 10:25 ` Bojan Smojver
2011-10-08 10:28 ` Bojan Smojver
2011-10-08 10:49 ` Dan Carpenter
2011-10-08 13:11 ` Bojan Smojver [this message]
2011-10-09 14:11 ` Dan Carpenter
2011-10-09 22:26 ` Bojan Smojver

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=4543687634.1002586283@rexursive.com \
    --to=bojan@rexursive.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox