lkml.org 
[lkml]   [2018]   [Jun]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH V2] xfs: fix string handling in get/set functions
    > diff --git a/fs/xfs/xfs_ioctl.c b/fs/xfs/xfs_ioctl.c
    > index 82f7c83c1dad..596e176c19a6 100644
    > --- a/fs/xfs/xfs_ioctl.c
    > +++ b/fs/xfs/xfs_ioctl.c
    > @@ -1828,13 +1828,13 @@ xfs_ioc_getlabel(
    > /* Paranoia */
    > BUILD_BUG_ON(sizeof(sbp->sb_fname) > FSLABEL_MAX);
    >
    > + /* 1 larger than sb_fname, so this ensures a trailing NUL char */
    > + memset(label, 0, sizeof(label));

    I don't get the comment. In fact I don't even get why we need any
    comment here. This is a structure that gets copied to userspace,
    and we zero the whole structure, as we should do by default for
    anything that goes to userspace.

    Otherwise this looks fine to me.

    \
     
     \ /
      Last update: 2018-06-06 12:59    [W:5.026 / U:0.216 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site