Re: [PATCH] [RFC v2] qnx: avoid -Wstringop-overread warning, again

From: Linus Torvalds
Date: Tue Sep 21 2021 - 11:41:35 EST


On Tue, Sep 21, 2021 at 8:15 AM Anders Larsen <al@xxxxxxxxxxx> wrote:
>
> they are available at the same offsets in struct qnx4_link_info as well, so
> wouldn't it be even simpler to just always use the fields of the latter
> structure?

I'd rather use that third "clearly neither" structure member, just to
clarify what is going on.

Yes, we could just always use the bigger structure, but then we'd
actually access a "link entry" even when it really isn't a link entry.

Now we can have that bogus entry and the big comment that says exactly
why we use the bogus entry, and it's clear that the "name" we use is
not necessarily a link entry or an inode entry, it's that special
union with a big comment about a gcc bug above it..

Anyway, I committed my patch that Arnd had tested, with a slightly
expanded comment. I'm sure yours would have compiled cleanly too.

Linus