lkml.org 
[lkml]   [2015]   [May]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] cgroup: add explicit cast and comment for return type conversion
On Mon, 25 May 2015, Tejun Heo wrote:

> Hello, Nicholas.
>
> On Mon, May 25, 2015 at 07:57:42AM +0200, Nicholas Mc Guire wrote:
> > nop not downward but signed/unsigned if it were down it would not be
> > a problem but signed/unsigned can be - for those cases where it can't
> > be fixed up by changing the declarations or return variable types
> > explicit cast might make sense - as noted in the patch Im not sure either
> > if this form of cleanups is helpful.
> >
> > In the kernel core there are about 400 signed/unsigned implicit
> > conversions (about 3k in the entire kernel) which is what Im trying to
> > remove or if that is not possible in a resonable way mark as false positive.
>
> I still don't get it. What does this buy us actually? If we continue
> to do this, people would just learn to add explicit cast when doing
> sign conversions. We just converge to a different behavior without
> actually gaining any protection. What's the benefit of doing this?
>
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.

thx!
hofrat


\
 
 \ /
  Last update: 2015-05-25 14:21    [W:0.070 / U:0.220 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site