Thread (54 messages) 54 messages, 5 authors, 2021-07-08

Re: [PATCH v3 07/15] fsnotify: pass arguments of fsnotify() in struct fsnotify_event_info

From: Amir Goldstein <amir73il@gmail.com>
Date: 2021-06-30 12:51:27
Also in: linux-fsdevel, oe-kbuild-all

On Wed, Jun 30, 2021 at 1:49 PM Dan Carpenter [off-list ref] wrote:
I think my bug report was not clear...  :/  The code looks like this:

        sb = inode->i_sb;

        if (inode) ...

The NULL check cannot be false because if "inode" is NULL we would have
already crashed when we dereference it on the line before.

In this case, based on last years discussion, the "inode" pointer can't
be NULL.  The debate is only whether the unnecessary NULL checks help
readability or hurt readability.
Right. Sorry, I forgot.

Anyway, patch 11/15 of the same series changes this code to:

 sb = event_info->sb ?: inode->i_sb;

So inode can and will be NULL coming from the caller of
fsnotify_sb_error(sb, NULL).

I think that should make smach happy?
You can try to run it after patch 11/15 of this series.

Thanks,
Amir.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help