public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <error27@gmail.com>
To: kernel-janitors@vger.kernel.org
Subject: Re: [PATCH 2/2] staging: keucr: Use memcpy() instad of custom
Date: Sun, 02 Jan 2011 05:34:09 +0000	[thread overview]
Message-ID: <20110102053409.GK1886@bicker> (raw)
In-Reply-To: <1293823712-6273-3-git-send-email-martinez.javier@gmail.com>

On Sun, Jan 02, 2011 at 12:41:33AM +0100, Gábor Stefanik wrote:
> On Fri, Dec 31, 2010 at 8:28 PM, Javier Martinez Canillas
> <martinez.javier@gmail.com> wrote:
> > +       DWORD err;
> > +       err = correct_data(buf, redundant_ecc, *(calculate_ecc+1),
> > +                          *(calculate_ecc), *(calculate_ecc+2));
> 
> Any reason why you didn't unify these 2 lines? Like this: DWORD err > correct_data(...);
> 

These kind of things aren't described in CodingStyle so they're up to
whoever writes the code to decide.  Or if the maintainer is a
micromanager the maintainer can decide.

But personally I much prefer to put anything complicated on separate
lines.  No one reads the initializers.  In my work with Smatch I see a
lot of bugs like this:

	int x = foo->bar;

	if (!foo)
		return -EINVAL;

It's astounding how many.  The famous tun.c security bug was one of
these.

But there should  have been a blank line between the initializers and
the code.  Otherwise people will think the code is initiliazation and
ignore it.  That is in CodingStyle I think.  We can fix that when we get
rid of the DWORD data type in a later patch (don't resend).

regards,
dan carpenter

--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

      parent reply	other threads:[~2011-01-02  5:34 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-31 19:28 [PATCH 2/2] staging: keucr: Use memcpy() instad of custom StringCopy() and some style cleanups Javier Martinez Canillas
2011-01-01 23:41 ` [PATCH 2/2] staging: keucr: Use memcpy() instad of custom Gábor Stefanik
2011-01-02  5:34 ` Dan Carpenter [this message]

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=20110102053409.GK1886@bicker \
    --to=error27@gmail.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