All of lore.kernel.org
 help / color / mirror / Atom feed
From: Richard Knutsson <ricknu-0@student.ltu.se>
To: kernel-janitors@vger.kernel.org
Subject: Re: [KJ] memory zeroing macros
Date: Mon, 12 Feb 2007 05:28:44 +0000	[thread overview]
Message-ID: <45CFFB0C.1080206@student.ltu.se> (raw)
In-Reply-To: <Pine.LNX.4.64.0702101731480.6852@CPE00045a9c397f-CM001225dbafb6>

Greg KH wrote:
> On Mon, Feb 12, 2007 at 01:51:20AM +0000, Srdjan Todorovic wrote:
>   
>> On Sun, 11 Feb 2007, Greg KH wrote:
>>     
>>> Not true at all, 0 and len get switched a lot accidentally.  See the
>>> archives for times people have swept the kernel tree to fix this issue
>>> up.
>>>       
>> I agree with you here, Greg, about accidentally switching the args to
>> memset(). However just because someone (I've done this in the past,
>> damn hard to debug since you don't expect to make this silly mistake)
>> can do:
>>
>>   if (x = 0)  { }
>>     
>
> gcc will now warn against this :)
>
> Anyway, anyone is welcome to sweep the kernel tree to see if there are
> any 0 for the len argument in the tree left.
>
> thanks,
>
> greg k-h
>   
linux-2.6]$ grep -Enr "memset *\(.*, *0 *\)" *
Documentation/scsi/ChangeLog.1992-1997:260:     * scsi.c (scan_scsis): memset(SDpnt, 0) and set SCmd.device to SDpnt.
include/asm-arm/uaccess.h:392:#define __clear_user(addr,n)              (memset((void __force *)addr, 0, n), 0)
include/asm-frv/uaccess.h:274:#define clear_user(dst,count)                    (memset(____force(dst), 0, (count)), 0)
linux-2.6]$ 

So it seems ok.
Added it to an error-script with whom I can scan the tree in irregular intervals.

Richard Knutsson


_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
https://lists.osdl.org/mailman/listinfo/kernel-janitors

  parent reply	other threads:[~2007-02-12  5:28 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-02-10 22:32 [KJ] memory zeroing macros Robert P. J. Day
2007-02-10 23:42 ` Alexey Dobriyan
2007-02-11  8:55 ` Robert P. J. Day
2007-02-11  9:24 ` Alexey Dobriyan
2007-02-11  9:32 ` Robert P. J. Day
2007-02-11 20:34 ` burns.ethan
2007-02-11 21:33 ` Greg KH
2007-02-12  1:51 ` Srdjan Todorovic
2007-02-12  4:43 ` Greg KH
2007-02-12  5:28 ` Richard Knutsson [this message]
2007-02-12  8:59 ` Robert P. J. Day

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=45CFFB0C.1080206@student.ltu.se \
    --to=ricknu-0@student.ltu.se \
    --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.