lkml.org 
[lkml]   [2012]   [Aug]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH 2/3] writeback: fix incorrect return value type of bdi_dirty_limit
    Il 19/08/2012 12:23, Marco Stornelli ha scritto:
    > Il 19/08/2012 04:17, Fengguang Wu ha scritto:
    >> On Sat, Aug 18, 2012 at 05:49:21AM -0400, Namjae Jeon wrote:
    >>> unsigned long bdi_dirty_limit(struct backing_dev_info *bdi, unsigned
    >>> long dirty)
    >>>
    >>> Above function return type is unsigned long, but return value is
    >>> kept in "u64 bdi_dirty".
    >>> It can return incorrect value by type casting.
    >>
    >> I don't see how the cast can return wrong value.
    >> The u64 is necessary for the intermediate calculations.
    >>
    >> Thanks,
    >> Fengguang
    >>
    >
    > We are sure u64 is 8byte long, but unsigned long is 4byte long on 32-bit
    > machine, so if bdi_dirty can assume values bigger than 2^32 there is an
    > implicit truncate of its value, isn't it?
    >
    > Marco

    Sorry but I didn't see the code, it seems not possible so the wrong
    situation can't happen. Maybe we can simply add a comment, nothing more.

    Marco


    \
     
     \ /
      Last update: 2012-08-19 13:21    [W:0.023 / U:0.068 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site