lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Thu, 12 Nov 2009 14:45:54 +0100
From:	Ingo Molnar <mingo@...e.hu>
To:	Andy Whitcroft <apw@...onical.com>
Cc:	Andrew Morton <akpm@...ux-foundation.org>,
	Roel Kluin <roel.kluin@...il.com>,
	LKML <linux-kernel@...r.kernel.org>, rostedt@...dmis.org
Subject: Re: [PATCH] ftrace: return error instead of 12 bytes read


* Andy Whitcroft <apw@...onical.com> wrote:

> >> ? ? ? s = kmalloc(sizeof(*s), GFP_KERNEL);
> >> ? ? ? if (!s)
> >> - ? ? ? ? ? ? return ENOMEM;
> >> + ? ? ? ? ? ? return -ENOMEM;
> >>
> >> ? ? ? trace_seq_init(s);
> >>
> >
> > lol, there we go again.
> >
> > Andy, can we have a checkpatch rule please?
> 
> Thats a tricky one.  Not only do we not really have a sensible way to 
> know if ENOMEM is an errno, we also find a bunch of places that we 
> appear to use positive errno's as return values where we would falsly 
> complain about.  Its particularly common in scsi and filesystems. 
> Admittedly the vast majority are return -EXXX form, so we could add 
> this as a non-default check perhaps.
> 
> Thoughts?

Even in filesystems, ~80% of the cases use proper negative values:

 $ git grep 'return -E' fs/ | wc -l
 4540
 $ git grep 'return E' fs/ | wc -l
 895

For SCSI it's even better, ~97% of the cases use the kernel's standard:

 $ git grep 'return -E' drivers/scsi/ | wc -l
 1448
 $ git grep 'return E' drivers/scsi/ | wc -l
 50

So i'd suggest to make this a default-enabled check. (default disabled 
checks are used only by a small minority) For a _long_ time has this 
been the kernel standard.

	Ingo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ