From: David Miller <davem@davemloft.net>
To: jacob.e.keller@intel.com
Cc: netdev@vger.kernel.org, jiri@resnulli.us, valex@mellanox.com,
parav@mellanox.com
Subject: Re: [net] devlink: report 0 after hitting end in region read
Date: Wed, 05 Feb 2020 14:25:00 +0100 (CET) [thread overview]
Message-ID: <20200205.142500.1124442901896236230.davem@davemloft.net> (raw)
In-Reply-To: <20200204235950.2209828-1-jacob.e.keller@intel.com>
From: Jacob Keller <jacob.e.keller@intel.com>
Date: Tue, 4 Feb 2020 15:59:50 -0800
> commit fdd41ec21e15 ("devlink: Return right error code in case of errors
> for region read") modified the region read code to report errors
> properly in unexpected cases.
>
> In the case where the start_offset and ret_offset match, it unilaterally
> converted this into an error. This causes an issue for the "dump"
> version of the command. In this case, the devlink region dump will
> always report an invalid argument:
>
> 000000000000ffd0 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
> 000000000000ffe0 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
> devlink answers: Invalid argument
> 000000000000fff0 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
>
> This occurs because the expected flow for the dump is to return 0 after
> there is no further data.
>
> The simplest fix would be to stop converting the error code to -EINVAL
> if start_offset == ret_offset. However, avoid unnecessary work by
> checking for when start_offset is larger than the region size and
> returning 0 upfront.
>
> Fixes: fdd41ec21e15 ("devlink: Return right error code in case of errors for region read")
> Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Applied and queued up for -stable, thanks.
prev parent reply other threads:[~2020-02-05 13:25 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-04 23:59 [net] devlink: report 0 after hitting end in region read Jacob Keller
2020-02-05 6:18 ` Jiri Pirko
2020-02-05 13:25 ` David Miller [this message]
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=20200205.142500.1124442901896236230.davem@davemloft.net \
--to=davem@davemloft.net \
--cc=jacob.e.keller@intel.com \
--cc=jiri@resnulli.us \
--cc=netdev@vger.kernel.org \
--cc=parav@mellanox.com \
--cc=valex@mellanox.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).