lkml.org 
[lkml]   [2004]   [Jun]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: Finding user/kernel pointer bugs [no html]
    On Thu, 10 Jun 2004 22:28:03 +0200 Sam Ravnborg wrote:

    | On Thu, Jun 10, 2004 at 12:32:08PM -0700, Greg KH wrote:
    | > On Thu, Jun 10, 2004 at 08:14:00PM +0100, viro@parcelfarce.linux.theplanet.co.uk wrote:
    | > > On Thu, Jun 10, 2004 at 12:10:04PM -0700, Greg KH wrote:
    | > > > @@ -170,8 +170,11 @@
    | > > > static int DIV_TO_REG(int val)
    | > > > {
    | > > > int answer = 0;
    | > > > - while ((val >>= 1))
    | > > > + val >>= 1;
    | > > > + while (val) {
    | > > > answer++;
    | > > > + val >>= 1;
    | > > > + }
    | > > > return answer;
    | > >
    | > > That's less readable than the original...
    | >
    | > Hm, so we should ignore the sparse warning about the original then?
    |
    | What about:
    |
    | while ((val >>= 1) != 0) {
    | ...
    |
    | Readable and sparse clean (I suppose).

    Exactly what I would suggest, based on a few days of doing these.
    Maintains the readability of the code much better than the other
    change did...

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

    \
     
     \ /
      Last update: 2005-03-22 14:03    [W:0.020 / U:119.036 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site