lkml.org 
[lkml]   [2006]   [Mar]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    SubjectRe: filldir[64] oddness
    From
    From: Dave Jones <davej@redhat.com>
    Date: Wed, 8 Mar 2006 23:27:44 -0500

    > #define NAME_OFFSET(de) ((int) ((de)->d_name - (char __user *) (de)))
    > #define ROUND_UP(x) (((x)+sizeof(long)-1) & ~(sizeof(long)-1))
    >
    > 140 static int filldir(void * __buf, const char * name, int namlen, loff_t offset,
    > 141 ino_t ino, unsigned int d_type)
    > 142 {
    > 143 struct linux_dirent __user * dirent;
    > 144 struct getdents_callback * buf = (struct getdents_callback *) __buf
    > 145 int reclen = ROUND_UP(NAME_OFFSET(dirent) + namlen + 2);
    >
    > How come that NAME_OFFSET isn't causing an oops when
    > it dereferences stackjunk->d_name ?

    d_name a char[] array, and we're just doing pointer arithmetic
    here. It's the same as "offsetof(d_name, struct linux_dirent)"
    or something like that.

    I think coverity is being trigger happy in this case :-)
    -
    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: 2006-03-09 05:34    [W:0.029 / U:60.796 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site