All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andi Drebes <lists-receive@programmierforen.de>
To: kernel-janitors@vger.kernel.org
Subject: Re: [PATCH 3/3] remove explicit memset to memory allocated with k[zc]alloc
Date: Mon, 31 Dec 2007 11:29:24 +0000	[thread overview]
Message-ID: <200712311229.25418.lists-receive@programmierforen.de> (raw)
In-Reply-To: <005801c841bb$6723d330$0b01a8c0@bureau>

> > There are quite a lot of statements like that in the kernel...
> > 
> > $ grep -r "sizeof(u8)" . | wc -l
> > 53
> 
> What is the problem you are trying to solve?
> It might in some places be an improvement to replace a sizeof(u8) with a 
> sizeof() on the actual variable, but blindly replacing sizeof(u8) with 1 
> sounds like an attempt to make the code harder to read without bringing 
> any advantage...
Perhaps my comments on the particular patch from Christophe sounded as if
they applied to all sizeof(u8) statements. I was not talking about *blindly*
replacing them. I didn't even say that they *all* should be replaced. What
I wanted to say was: maybe one should have a look at other places in the
kernel aswell. The above grep was just a quick grep through the sources.

Of course, there's no functional problem with sizeof(u8). It should be kept
in places where it makes things clear. But in my eyes, sizeof(u8) in something
like this (as in the lines affected by the patch):

kmalloc(sizeof(u8) * IOP_ADMA_TEST_SIZE, GFP_KERNEL);

isn't very useful. I think it's quite clear that kmalloc takes a number of
bytes as the first argument. So replacing the above code with the following

kmalloc(IOP_ADMA_TEST_SIZE, GFP_KERNEL);

would save some bytes and make it compile faster. And it isn't harder to read.
However, I don't insist on changes like that. I just thought that for
drivers/dma/iop-adma.c it may be included in Christophe's patch.

	Andi

      parent reply	other threads:[~2007-12-31 11:29 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-12-18 21:17 [PATCH 3/3] remove explicit memset to memory allocated with k[zc]alloc Christophe Jaillet
2007-12-18 22:53 ` Andi Drebes
2007-12-31  0:51 ` [PATCH 3/3] remove explicit memset to memory allocated with Adrian Bunk
2007-12-31 11:29 ` Andi Drebes [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=200712311229.25418.lists-receive@programmierforen.de \
    --to=lists-receive@programmierforen.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.