lkml.org 
[lkml]   [2017]   [Dec]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] epoll: fix dereferenced before check pt
On Thu, Dec 21, 2017 at 04:54:17PM +0100, Vasyl Gomonovych wrote:
> This patch fixes the warning reported by smatch:
>
> fs/eventpoll.c:889 ep_item_poll() warn: variable dereferenced before check 'pt'

... and of course, that is all the analysis one might want - the tool has
spoken. Except that the only thing proven is that the tool is either misused
or just plain crappy.

Callers of ep_item_poll() are easily found - it's static, so they all are in
the same file. All four of them -
if (ep_item_poll(epi, &pt, depth)) {
revents = ep_item_poll(epi, &epq.pt, 1);
if (ep_item_poll(epi, &pt, 1)) {
revents = ep_item_poll(epi, &pt, 1);

Figuring out why an address of a local variable or of a field thereof can never
be NULL is left as an exercise for an introductory course on C.

"Fixing warnings" is bloody wrong - warning (from any tool) is a heuristic
pointing to a place that might be worth looking into. In cases when you've
found a real problem with help from some tool, sure, go ahead and credit that
tool in the commit message. Along with the description of the problem
you've found.

\
 
 \ /
  Last update: 2017-12-22 01:02    [W:0.067 / U:0.040 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site