On 10/26/20 10:35 AM, Al Viro wrote:
On Mon, Oct 26, 2020 at 10:09:47AM +0800, kernel test robot wrote:
tree: https://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs.git work.epoll
head: 319c15174757aaedacc89a6e55c965416f130e64
commit: ff07952aeda8563d5080da3a0754db83ed0650f6 [17/27] ep_send_events_proc(): fold into the caller
compiler: h8300-linux-gcc (GCC) 9.3.0
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>
"cppcheck warnings: (new ones prefixed by >>)"
fs/eventpoll.c:1629:3: warning: Assignment of function parameter has no effect outside the function. Did you forget dereferencing it? [uselessAssignmentPtrArg]
events++;
^
Who the hell has come up with that warning? What happens is,
essentially,
f(..., events, ....)
loop in which we have
g(events, something); // store the next sample
events++;
More specifically, it's
1620 if (__put_user(revents, &events->events) ||
1621 __put_user(epi->event.data, &events->data)) {
1622 list_add(&epi->rdllink, &txlist);
1623 ep_pm_stay_awake(epi);
1624 if (!res)
1625 res = -EFAULT;
1626 break;
1627 }
1628 res++;
1629 events++;
If anything, that should be reported to the maintainers of the buggy code.
Which is not the kernel in this case.
Google search on that thing brings this:
Cppcheck is an analysis tool for C/C++ code. It detects the types of
bugs that the compilers normally fail to detect. The goal is no false positives.
IOW, that should be reported to the authors of that thing, seeing that
their stated goal is obviously missed in this case. Badly. Assignments of
function parameters can be perfectly idiomatic and this case is such.
Hi Al,
Thanks for the explanation, we'll avoid sending out such reports
automatically
and double check the warning.
Best Regards,
Rong Chen