From: Alexey Dobriyan <adobriyan@gmail.com>
To: linux-xfs@vger.kernel.org
Cc: darrick.wong@oracle.com
Subject: "signed < sizeof()" bug in xfs_attr_shortform_verify() ?
Date: Wed, 26 Aug 2020 00:10:48 +0300 [thread overview]
Message-ID: <20200825211048.GA2162993@localhost.localdomain> (raw)
xfs_attr_shortform_verify() contains the following code:
int64_t size = ifp->if_bytes;
/*
* Give up if the attribute is way too short.
*/
if (size < sizeof(struct xfs_attr_sf_hdr))
return __this_address;
In general "if (signed < sizeof())" is wrong because of how type
promotions work. Such check won't catch small negative values.
I don't know XFS well enough to know if negative values were excluded
somewhere above the callchain, but maybe someone else does.
next reply other threads:[~2020-08-25 21:10 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-25 21:10 Alexey Dobriyan [this message]
2020-08-25 22:18 ` "signed < sizeof()" bug in xfs_attr_shortform_verify() ? Darrick J. Wong
2020-08-27 8:15 ` Christoph Hellwig
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=20200825211048.GA2162993@localhost.localdomain \
--to=adobriyan@gmail.com \
--cc=darrick.wong@oracle.com \
--cc=linux-xfs@vger.kernel.org \
/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