From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.7 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,MENTIONS_GIT_HOSTING, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C7E98C388F7 for ; Mon, 26 Oct 2020 03:02:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7F0052076A for ; Mon, 26 Oct 2020 03:02:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1420581AbgJZDCk (ORCPT ); Sun, 25 Oct 2020 23:02:40 -0400 Received: from zeniv.linux.org.uk ([195.92.253.2]:56864 "EHLO ZenIV.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389589AbgJZDCj (ORCPT ); Sun, 25 Oct 2020 23:02:39 -0400 X-Greylist: delayed 1591 seconds by postgrey-1.27 at vger.kernel.org; Sun, 25 Oct 2020 23:02:38 EDT Received: from viro by ZenIV.linux.org.uk with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1kWsMZ-008uQf-1v; Mon, 26 Oct 2020 02:35:59 +0000 Date: Mon, 26 Oct 2020 02:35:59 +0000 From: Al Viro To: kernel test robot Cc: kbuild-all@lists.01.org, linux-fsdevel@vger.kernel.org Subject: 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 Message-ID: <20201026023559.GC3576660@ZenIV.linux.org.uk> References: <202010261043.dPTrCpUD-lkp@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <202010261043.dPTrCpUD-lkp@intel.com> Sender: Al Viro Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org 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 > > > "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. From mboxrd@z Thu Jan 1 00:00:00 1970 Content-Type: multipart/mixed; boundary="===============7074158256227030230==" MIME-Version: 1.0 From: Al Viro To: kbuild-all@lists.01.org Subject: 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 02:35:59 +0000 Message-ID: <20201026023559.GC3576660@ZenIV.linux.org.uk> In-Reply-To: <202010261043.dPTrCpUD-lkp@intel.com> List-Id: --===============7074158256227030230== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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_p= roc(): 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 > = > = > "cppcheck warnings: (new ones prefixed by >>)" > >> fs/eventpoll.c:1629:3: warning: Assignment of function parameter has n= o effect outside the function. Did you forget dereferencing it? [uselessAss= ignmentPtrArg] > 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 =3D -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 posit= ives. 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. --===============7074158256227030230==--