linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Laight <David.Laight@ACULAB.COM>
To: 'Tong Zhang' <ztong0001@gmail.com>,
	Anders Larsen <al@alarsen.net>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: RE: [PATCH v2] qnx4: do not interpret -EIO as a correct address
Date: Mon, 2 Nov 2020 22:44:58 +0000	[thread overview]
Message-ID: <e457351a04e04aa084902fd5138d4cae@AcuMS.aculab.com> (raw)
In-Reply-To: <20201102201536.1267680-1-ztong0001@gmail.com>

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@gmail.com>
> ---
> v2: also check other callers according to Anders Larsen's<al@alarsen.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)


  reply	other threads:[~2020-11-02 22:45 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-23 21:16 [PATCH] qnx4: do not interpret -EIO as a correct address Tong Zhang
2020-11-02  9:12 ` Anders Larsen
2020-11-02 20:15   ` [PATCH v2] " Tong Zhang
2020-11-02 22:44     ` David Laight [this message]
2020-11-02 23:14       ` [PATCH v3] qnx4: qnx4_block_map error handling Tong Zhang
2020-11-03 10:54         ` David Laight
2020-11-03 13:52           ` Tong Zhang
2020-11-03 21:57             ` David Laight
2020-11-03 22:32               ` Tong Zhang
2020-11-11  1:33                 ` Tong Zhang
2020-11-03 17:35           ` [PATCH v4] " Tong Zhang
2020-11-02 23:17       ` [PATCH v2] qnx4: do not interpret -EIO as a correct address Tong Zhang
2020-11-02 20:17   ` [PATCH] " Tong Zhang

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=e457351a04e04aa084902fd5138d4cae@AcuMS.aculab.com \
    --to=david.laight@aculab.com \
    --cc=al@alarsen.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ztong0001@gmail.com \
    /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;
as well as URLs for NNTP newsgroup(s).