From: Randy Dunlap <rdunlap@infradead.org>
To: "linux-block@vger.kernel.org" <linux-block@vger.kernel.org>,
LKML <linux-kernel@vger.kernel.org>, axboe <axboe@kernel.dk>
Cc: Scott Bauer <scott.bauer@intel.com>,
Rafael Antognolli <rafael.antognolli@intel.com>
Subject: [PATCH 2/2] block: sed-opal: fix sparse warning: convert __be64 data
Date: Wed, 2 Oct 2019 19:23:15 -0700 [thread overview]
Message-ID: <82f70133-7242-d113-f041-9b89694685c0@infradead.org> (raw)
From: Randy Dunlap <rdunlap@infradead.org>
sparse warns about incorrect type when using __be64 data.
It is not being converted to CPU-endian but it should be.
Fixes these sparse warnings:
../block/sed-opal.c:375:20: warning: incorrect type in assignment (different base types)
../block/sed-opal.c:375:20: expected unsigned long long [usertype] align
../block/sed-opal.c:375:20: got restricted __be64 const [usertype] alignment_granularity
../block/sed-opal.c:376:25: warning: incorrect type in assignment (different base types)
../block/sed-opal.c:376:25: expected unsigned long long [usertype] lowest_lba
../block/sed-opal.c:376:25: got restricted __be64 const [usertype] lowest_aligned_lba
Fixes: 455a7b238cd6 ("block: Add Sed-opal library")
Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Cc: Scott Bauer <scott.bauer@intel.com>
Cc: Rafael Antognolli <rafael.antognolli@intel.com>
Cc: Jens Axboe <axboe@kernel.dk>
Cc: linux-block@vger.kernel.org
---
If this code is known to work as is, it would be nice to have an
explanation of it. Oh: maybe it's just that these fields are not
used after they are saved/set.
block/sed-opal.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
--- lnx-54-rc1.orig/block/sed-opal.c
+++ lnx-54-rc1/block/sed-opal.c
@@ -372,8 +372,8 @@ static void check_geometry(struct opal_d
{
const struct d0_geometry_features *geo = data;
- dev->align = geo->alignment_granularity;
- dev->lowest_lba = geo->lowest_aligned_lba;
+ dev->align = be64_to_cpu(geo->alignment_granularity);
+ dev->lowest_lba = be64_to_cpu(geo->lowest_aligned_lba);
}
static int execute_step(struct opal_dev *dev,
next reply other threads:[~2019-10-03 2:23 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-03 2:23 Randy Dunlap [this message]
2019-10-03 15:40 ` [PATCH 2/2] block: sed-opal: fix sparse warning: convert __be64 data Scott Bauer
2019-10-03 17:06 ` Derrick, Jonathan
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=82f70133-7242-d113-f041-9b89694685c0@infradead.org \
--to=rdunlap@infradead.org \
--cc=axboe@kernel.dk \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rafael.antognolli@intel.com \
--cc=scott.bauer@intel.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).