linux-parisc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Helge Deller <deller@gmx.de>
To: dm-devel@redhat.com, linux-parisc@vger.kernel.org
Subject: [PATCH] md: fix compiler warning: large integer implicitly truncated to unsigned type
Date: Mon, 2 Dec 2013 20:12:20 +0100	[thread overview]
Message-ID: <20131202191220.GA2314@ls3530.box> (raw)

Compiling a 32bit kernel with CONFIG_LBDAF=3Dn gives this compiler warn=
ing:
/drivers/md/md.c: In function =E2=80=98super_90_load=E2=80=99:
/drivers/md/md.c:1068:3: warning: large integer implicitly truncated to=
 unsigned type [-Woverflow]

=46ix it by casting the calculated value to a sector_t type.

Signed-off-by: Helge Deller <deller@gmx.de>

diff --git a/drivers/md/md.c b/drivers/md/md.c
index e60cebf..b56f1c7 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -1065,7 +1065,7 @@ static int super_90_load(struct md_rdev *rdev, st=
ruct md_rdev *refdev, int minor
 	 * record this size)
 	 */
 	if (rdev->sectors >=3D (2ULL << 32) && sb->level >=3D 1)
-		rdev->sectors =3D (2ULL << 32) - 2;
+		rdev->sectors =3D (sector_t) ((2ULL << 32) - 2);
=20
 	if (rdev->sectors < ((sector_t)sb->size) * 2 && sb->level >=3D 1)
 		/* "this cannot possibly happen" ... */
@@ -1356,7 +1356,7 @@ super_90_rdev_size_change(struct md_rdev *rdev, s=
ector_t num_sectors)
 	 * 4TB =3D=3D 2^32 KB, or 2*2^32 sectors.
 	 */
 	if (num_sectors >=3D (2ULL << 32) && rdev->mddev->level >=3D 1)
-		num_sectors =3D (2ULL << 32) - 2;
+		num_sectors =3D (sector_t) ((2ULL << 32) - 2);
 	md_super_write(rdev->mddev, rdev, rdev->sb_start, rdev->sb_size,
 		       rdev->sb_page);
 	md_super_wait(rdev->mddev);
--
To unsubscribe from this list: send the line "unsubscribe linux-parisc"=
 in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

             reply	other threads:[~2013-12-02 19:12 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-02 19:12 Helge Deller [this message]
2013-12-03 13:47 ` [dm-devel] [PATCH] md: fix compiler warning: large integer implicitly truncated to unsigned type Thadeu Lima de Souza Cascardo

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=20131202191220.GA2314@ls3530.box \
    --to=deller@gmx.de \
    --cc=dm-devel@redhat.com \
    --cc=linux-parisc@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;
as well as URLs for NNTP newsgroup(s).