linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Rong Chen <rong.a.chen@intel.com>
To: Al Viro <viro@zeniv.linux.org.uk>, kernel test robot <lkp@intel.com>
Cc: kbuild-all@lists.01.org, linux-fsdevel@vger.kernel.org
Subject: Re: [kbuild-all] Re: [vfs:work.epoll 17/27] fs/eventpoll.c:1629:3: warning: Assignment of function parameter has no effect outside the function. Did you forget dereferencing
Date: Mon, 26 Oct 2020 17:45:40 +0800	[thread overview]
Message-ID: <35d2f16c-7b53-0088-7e7c-aa04451b8fb8@intel.com> (raw)
In-Reply-To: <20201026023559.GC3576660@ZenIV.linux.org.uk>



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@intel.com>
>>
>>
>> "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



      reply	other threads:[~2020-10-26 10:15 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-26  2:09 [vfs:work.epoll 17/27] fs/eventpoll.c:1629:3: warning: Assignment of function parameter has no effect outside the function. Did you forget dereferencing kernel test robot
2020-10-26  2:35 ` Al Viro
2020-10-26  9:45   ` Rong Chen [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=35d2f16c-7b53-0088-7e7c-aa04451b8fb8@intel.com \
    --to=rong.a.chen@intel.com \
    --cc=kbuild-all@lists.01.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=lkp@intel.com \
    --cc=viro@zeniv.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).