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]
Message-ID: <20150526000538.GH7099@htj.duckdns.org>
Date:	Mon, 25 May 2015 20:05:38 -0400
From:	Tejun Heo <tj@...nel.org>
To:	Nicholas Mc Guire <der.herr@...r.at>
Cc:	Nicholas Mc Guire <hofrat@...dl.org>,
	Li Zefan <lizefan@...wei.com>, cgroups@...r.kernel.org,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH] cgroup: add explicit cast and comment for return type
 conversion

Hello, Nicholas.

On Mon, May 25, 2015 at 01:50:47PM +0200, Nicholas Mc Guire wrote:
> that would be no benefit of course - the goal is not to simply put casts
> in but to use casts as last resort if type cleanups are not doable or if
> the type missmatch is intended - the cast then should document that it
> is intentional and comments explain why it is justified. If that were the
> result of type cleanup I think it would benefit the kernel code as I 
> suspect that quite a few of the type missmatches simply happened.

I'm having a bit of hard time agreeing with the utility of this.  If
you can fix up the variable type to go away, sure, but adding
unnecessary explicit cast and comment for something this trivial?  I'm
not sure.  I mean, C is not a language which can propagate param
constraints to the return types.  e.g. strnlen() will happily return
size_t even when the maximum length is e.g. int.  We simply aren't
writing in a language where these things are easily distinguished and
I'm not sure shoehorning explicit constraints all over the source code
brings enough benefit to justify the added noise.

If you can identify actual problem cases, awesome.  If some can easily
be removed by tweaking types to match the actual usage, great too, but
let's please not do this explicit version of implicit casts and
pointless comments.

Thanks.

-- 
tejun
--
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