[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAOQ4uxh9s8ukzyUvADZzF-kyTGXgZxdei9LyfzEDHJ_h+wKRFg@mail.gmail.com>
Date: Wed, 5 Aug 2020 19:58:57 +0300
From: Amir Goldstein <amir73il@...il.com>
To: kernel test robot <lkp@...el.com>
Cc: kbuild-all@...ts.01.org,
linux-kernel <linux-kernel@...r.kernel.org>,
Jan Kara <jack@...e.cz>
Subject: Re: fs/notify/fanotify/fanotify_user.c:370:3: warning: Assignment of
function parameter has no effect outside the function. Did you forget dereferencing
On Wed, Aug 5, 2020 at 10:40 AM kernel test robot <lkp@...el.com> wrote:
>
> tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
> head: 4da9f3302615f4191814f826054846bf843e24fa
> commit: 44d705b0370b1d581f46ff23e5d33e8b5ff8ec58 fanotify: report name info for FAN_DIR_MODIFY event
> date: 4 months ago
Gee that's an old patch...
> compiler: nds32le-linux-gcc (GCC) 9.3.0
>
> If you fix the issue, kindly add following tag as appropriate
> Reported-by: kernel test robot <lkp@...el.com>
>
>
> cppcheck warnings: (new ones prefixed by >>)
>
> >> fs/notify/fanotify/fanotify_user.c:370:3: warning: Assignment of function parameter has no effect outside the function. Did you forget dereferencing it? [uselessAssignmentPtrArg]
> buf += ret;
> ^
> >> fs/notify/fanotify/fanotify_user.c:371:3: warning: Assignment of function parameter has no effect outside the function. [uselessAssignmentArg]
> count -= ret;
> ^
...
> 348 /* Event info records order is: dir fid + name, child fid */
> 349 if (fanotify_event_name_len(event)) {
> 350 struct fanotify_name_event *fne = FANOTIFY_NE(event);
> 351
> 352 ret = copy_info_to_user(fanotify_event_fsid(event),
> 353 fanotify_event_dir_fh(event),
> 354 fne->name, fne->name_len,
> 355 buf, count);
> 356 if (ret < 0)
> 357 return ret;
> 358
> 359 buf += ret;
> 360 count -= ret;
> 361 }
> 362
> 363 if (fanotify_event_object_fh_len(event)) {
> 364 ret = copy_info_to_user(fanotify_event_fsid(event),
> 365 fanotify_event_object_fh(event),
> 366 NULL, 0, buf, count);
> 367 if (ret < 0)
> 368 return ret;
> 369
> > 370 buf += ret;
> > 371 count -= ret;
> 372 }
This is intentional.
The code is more readable and robust this way even though these
assignments have no effect in current code.
Thanks,
Amir.
Powered by blists - more mailing lists