lists.openwall.net | lists / announce owl-users owl-dev john-users john-dev passwdqc-users yescrypt popa3d-users / oss-security kernel-hardening musl sabotage tlsify passwords / crypt-dev xvendor / Bugtraq Full-Disclosure linux-kernel linux-netdev linux-ext4 linux-hardening linux-cve-announce PHC | |
Open Source and information security mailing list archives
| ||
|
Date: Mon, 2 Nov 2020 22:44:58 +0000 From: David Laight <David.Laight@...LAB.COM> To: 'Tong Zhang' <ztong0001@...il.com>, Anders Larsen <al@...rsen.net>, "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org> Subject: RE: [PATCH v2] qnx4: do not interpret -EIO as a correct address From: Tong Zhang > Sent: 02 November 2020 20:16 > > qnx4_block_map() may return -EIO on funny qnx4 fs image, in this case do > not interpret -EIO as a correct address 'Block number' not 'address'. > Signed-off-by: Tong Zhang <ztong0001@...il.com> > --- > v2: also check other callers according to Anders Larsen's<al@...rsen.net> comment > fs/qnx4/dir.c | 2 ++ > fs/qnx4/inode.c | 2 ++ > fs/qnx4/namei.c | 3 +++ > 3 files changed, 7 insertions(+) > > diff --git a/fs/qnx4/dir.c b/fs/qnx4/dir.c > index a6ee23aadd28..11aaf59f0411 100644 > --- a/fs/qnx4/dir.c > +++ b/fs/qnx4/dir.c > @@ -31,6 +31,8 @@ static int qnx4_readdir(struct file *file, struct dir_context *ctx) > > while (ctx->pos < inode->i_size) { > blknum = qnx4_block_map(inode, ctx->pos >> QNX4_BLOCK_SIZE_BITS); > + if (blknum == -EIO) > + return -EIO; Since 'blknum' is 'unsigned long' doesn't this generate a compiler warning about the condition being always false? (C requires the -EIO be converted to the equivalent unsigned bit-pattern - but that doesn't stop the compiler deciding it is dubious.) If it doesn't this week, it might next week. What about other error codes that might get returned. Someone seeing that EIO is valid might decide an other error can be returned. You probably ought to allow for all errno values or use ~0ull as an error value. David - Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK Registration No: 1397386 (Wales)
Powered by blists - more mailing lists