[lkml]   [2007]   [May]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
    Patch in this message
    Subject[PATCH] Bug in fs/afs/write.c function afs_write_back_from_locked_page()
    Following bug was uncovered by compiling with '-W' flag:

    CC [M] fs/afs/write.o
    fs/afs/write.c: In function ‘afs_write_back_from_locked_page’:
    fs/afs/write.c:398: warning: comparison of unsigned expression >= 0 is always true

    Loop variable 'n' is unsigned, so wraps around happily as far as I can
    see. Trival fix attached (compile tested only).

    Signed-Off-By: Mika Kukkonen <>

    diff --git a/fs/afs/write.c b/fs/afs/write.c
    index 83ff292..4bca263 100644
    --- a/fs/afs/write.c
    +++ b/fs/afs/write.c
    @@ -395,8 +395,9 @@ static int afs_write_back_from_locked_page(struct afs_writeback *wb,
    if (n == 0)
    goto no_more;
    if (pages[0]->index != start) {
    - for (n--; n >= 0; n--)
    + for (n--; n > 0; n--)
    + put_page(pages[0]);
    goto no_more;

    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to
    More majordomo info at
    Please read the FAQ at
     \ /
      Last update: 2007-05-10 14:07    [W:0.021 / U:15.596 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site