Skip to contentSkip to conversation

raid: fix printk format warnings

PATCH In review Randy Dunlap 2 participants 4 messages Oct 21, 2006 – Oct 23, 2006 MD RAID

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 raid: fix printk format warnings

From: Randy Dunlap <[email protected]>

Fix printk format warnings, seen on powerpc64:
drivers/md/raid1.c:1479: warning: long long unsigned int format, long unsigned int arg (arg 4) drivers/md/raid10.c:1475: warning: long long unsigned int format, long unsigned int arg (arg 4)

---

 drivers/md/raid1.c  |    4 ++--
 drivers/md/raid10.c |    4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)
drivers/md/raid1.c renamed from drivers/md/raid1.c~raid_printk +2 -2
diff -Naurp linux-2619-rc2g4/drivers/md/raid1.c~raid_printk linux-2619-rc2g4/drivers/md/raid1.c
@@ -1474,8 +1474,8 @@ static void fix_read_error(conf_t *conf,
 					       "raid1:%s: read error corrected "
 					       "(%d sectors at %llu on %s)\n",
 					       mdname(mddev), s,
-					       (unsigned long long)sect +
-					           rdev->data_offset,
+					       (unsigned long long)(sect +
+					           rdev->data_offset),
 					       bdevname(rdev->bdev, b));
 				}
 			}
drivers/md/raid10.c renamed from drivers/md/raid10.c~raid_printk +2 -2
diff -Naurp linux-2619-rc2g4/drivers/md/raid10.c~raid_printk linux-2619-rc2g4/drivers/md/raid10.c
@@ -1470,8 +1470,8 @@ static void fix_read_error(conf_t *conf,
 					       "raid10:%s: read error corrected"
 					       " (%d sectors at %llu on %s)\n",
 					       mdname(mddev), s,
-					       (unsigned long long)sect+
-					            rdev->data_offset,
+					       (unsigned long long)(sect +
+					            rdev->data_offset),
 					       bdevname(rdev->bdev, b));
 
 				rdev_dec_pending(rdev, mddev);

---

#1 lore raw
Quoted 17 lines · On Saturday October 21, [email protected] wrote:

From: Randy Dunlap <[email protected]>

Fix printk format warnings, seen on powerpc64:
drivers/md/raid1.c:1479: warning: long long unsigned int format, long unsigned int arg (arg 4) drivers/md/raid10.c:1475: warning: long long unsigned int format, long unsigned int arg (arg 4)

---

 drivers/md/raid1.c  |    4 ++--
 drivers/md/raid10.c |    4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff -Naurp linux-2619-rc2g4/drivers/md/raid1.c~raid_printk linux-2619-rc2g4/drivers/md/raid1.c

drivers/md/raid1.c static void fix_read_error(conf_t *conf, · line 1480

Quoted 9 lines
drivers/md/raid1.c renamed from drivers/md/raid1.c~raid_printk +2 -2
@@ -1474,8 +1474,8 @@ static void fix_read_error(conf_t *conf,
 					       "raid1:%s: read error corrected "
 					       "(%d sectors at %llu on %s)\n",
 					       mdname(mddev), s,
-					       (unsigned long long)sect +
-					           rdev->data_offset,
+					       (unsigned long long)(sect +
+					           rdev->data_offset),
 					       bdevname(rdev->bdev,
 b));

So you're saying that if you add an 'unsigned long long int' to an 'unsigned long int', the result is an 'unsigned long int'??? That is not what I would have expected.
I'm happy with the patch, but I'm very surprised that it is needed. Is this behaviour consistent across various versions of gcc (if it is convenient to check)??

Thanks,
NeilBrown

#2 lore raw
Quoted 26 lines · Neil Brown
Quoted 25 lines · On Saturday October 21, [email protected] wrote:

From: Randy Dunlap <[email protected]>

Fix printk format warnings, seen on powerpc64:
drivers/md/raid1.c:1479: warning: long long unsigned int format, long unsigned int arg (arg 4) drivers/md/raid10.c:1475: warning: long long unsigned int format, long unsigned int arg (arg 4)

---

 drivers/md/raid1.c  |    4 ++--
 drivers/md/raid10.c |    4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff -Naurp linux-2619-rc2g4/drivers/md/raid1.c~raid_printk linux-2619-rc2g4/drivers/md/raid1.c

drivers/md/raid1.c renamed from drivers/md/raid1.c~raid_printk +2 -2
@@ -1474,8 +1474,8 @@ static void fix_read_error(conf_t *conf,
 					       "raid1:%s: read error corrected "
 					       "(%d sectors at %llu on %s)\n",
 					       mdname(mddev), s,
-					       (unsigned long long)sect +
-					           rdev->data_offset,
+					       (unsigned long long)(sect +
+					           rdev->data_offset),
 					       bdevname(rdev->bdev,
Quoted 8 lines

drivers/md/raid1.c static void fix_read_error(conf_t *conf, · line 1480

Quoted 1 line
drivers/md/raid1.c renamed from drivers/md/raid1.c~raid_printk +0 -0
 b));

So you're saying that if you add an 'unsigned long long int' to an 'unsigned long int', the result is an 'unsigned long int'??? That is not what I would have expected.
I'm happy with the patch, but I'm very surprised that it is needed. Is this behaviour consistent across various versions of gcc (if it is convenient to check)??

I've only seen it on powerpc64. It could well be a gcc problem AFAICT. Feel free to drop it. Thanks for the discussion.

gfs2 and DLM also produce about 10-12 of these warnings IIRC (still on powerpc64).

Signature · 1 line
~Randy
#3 lore raw
Quoted 3 lines · On Saturday October 21, [email protected] wrote:

I've only seen it on powerpc64. It could well be a gcc problem AFAICT. Feel free to drop it. Thanks for the discussion.

I think it is a gcc problem, but it is harmless to work around it, so I'll take the patch. Reducing warnings is a good idea.

Thanks,
NeilBrown