All of lore.kernel.org
 help / color / mirror / Atom feed
From: Wolfgang Grandegger <wg@grandegger.com>
To: David Miller <davem@davemloft.net>
Cc: sam@ravnborg.org, oliver.hartkopp@volkswagen.de,
	socketcan-core@lists.berlios.de, netdev@vger.kernel.org,
	urs.thuermann@volkswagen.de, xemul@openvz.org
Subject: Re: [PATCH][CAN]: Fix copy_from_user() results interpretation.
Date: Sat, 26 Apr 2008 15:04:30 +0200	[thread overview]
Message-ID: <4813285E.1000407@grandegger.com> (raw)
In-Reply-To: <20080426.000302.177643527.davem@davemloft.net>

David Miller wrote:
> From: Sam Ravnborg <sam@ravnborg.org>
> Date: Sat, 26 Apr 2008 08:40:07 +0200
> 
>> On Sat, Apr 26, 2008 at 08:19:31AM +0200, Wolfgang Grandegger wrote:
>>> What about removing the assignment "err =" in that case.
>> Preferred.
>>
>> See sample patch below (made on top of -linus
>> so it does likely not apply but made it only to
>> see the difference anyway).
> 
> I want to make one comment, directed at Wolfgang.
> 
> You are absolutely wrong, Wolfgang, in saying that Pavel's
> original patch isn't easier to review than just changing
> this code to go:
> 
> 	if (copy_*_user())
> 		return -EFAULT;
> 
> In fact, recoding things like this is an immense extra hardship on a
> reviewer.  I'll explain why.
> 
> If I see a patch that changes:
> 
> 	err = SOMETHING;
> 	break;
> 
> into:
> 
> 	err = SOMETHING_ELSE;
> 	break;
> 
> I know, WITH JUST READING THE PATCH, exactly what the side effects of
> this change are.
> 
> I DO NOT need to bring the code into my editor and validate side
> effects to the surrounding code.
> 
> I know that the assignment to 'err' is being changed, and that's it.
> 
> Whereas if you change:
> 
> 	err = SOMETHING;
> 	break;
> 
> into:
> 
> 	if (SOMETHING)
> 		return -SOME_ERROR;
> 	break;
> 
> I now have to bring the code into an editor and make sure that the
> control flow change doesn't break things.
> 
> For example, maybe the exit of the switch statement was important, to
> make sure cleanup code runs at the end of the function to release
> locks, free allocated memory, etc.
> 
> With Pavel's patch it is not necessary to make such validations so
> it's INFINITELY easier to validate.

OK, I see, if you have to review a lot of patches, it does matter, indeed.

Wolfgang.


  reply	other threads:[~2008-04-26 13:04 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-25 12:42 [PATCH][CAN]: Fix copy_from_user() results interpretation Pavel Emelyanov
2008-04-25 14:22 ` Oliver Hartkopp
2008-04-26  6:19   ` Wolfgang Grandegger
2008-04-26  6:23     ` David Miller
2008-04-26  6:35       ` Wolfgang Grandegger
2008-04-26  6:40     ` Sam Ravnborg
2008-04-26  7:03       ` David Miller
2008-04-26 13:04         ` Wolfgang Grandegger [this message]
2008-04-26  8:26       ` Oliver Hartkopp
2008-04-26  9:10         ` David Miller
2008-04-26  9:59           ` Sam Ravnborg
2008-04-26 10:01             ` David Miller
2008-04-26 10:05               ` Sam Ravnborg
2008-04-27  5:57             ` David Miller
     [not found] <mailman.2289.1209191345.4974.socketcan-core@lists.berlios.de>
2008-04-26  6:33 ` David Miller

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=4813285E.1000407@grandegger.com \
    --to=wg@grandegger.com \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    --cc=oliver.hartkopp@volkswagen.de \
    --cc=sam@ravnborg.org \
    --cc=socketcan-core@lists.berlios.de \
    --cc=urs.thuermann@volkswagen.de \
    --cc=xemul@openvz.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.