Skip to contentSkip to conversation

sound: isa: gus: fix misuse of %x

PATCH Applied Fuqian Huang 2 participants 2 messages Apr 21, 2019 – Apr 23, 2019 Sound

lore
Share & tools
lore
#0 lore raw

PATCH v2 6/6 sound: isa: gus: fix misuse of %x

Pointers should be printed with %p or %px rather than cast to long type and printed with %lx. Change %lx to %p to print the pointer.

---
 sound/isa/gus/gus_mem.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
sound/isa/gus/gus_mem.c +1 -1
index 4ac76f4..63e790f 100644
@@ -306,7 +306,7 @@ static void snd_gf1_mem_info_read(struct snd_info_entry *entry,
 	used = 0;
 	for (block = alloc->first, i = 0; block; block = block->next, i++) {
 		used += block->size;
-		snd_iprintf(buffer, "Block %i at 0x%lx onboard 0x%x size %i (0x%x):\n", i, (long) block, block->ptr, block->size, block->size);
+		snd_iprintf(buffer, "Block %i at 0x%p onboard 0x%x size %i (0x%x):\n", i, block, block->ptr, block->size, block->size);
 		if (block->share ||
 		    block->share_id[0] || block->share_id[1] ||
 		    block->share_id[2] || block->share_id[3])
Signature · 1 line
2.11.0
#1 lore raw
Quoted 6 lines · Fuqian Huang

Pointers should be printed with %p or %px rather than cast to long type and printed with %lx. Change %lx to %p to print the pointer.

IMO, it's better to drop the address printing itself. We don't want to expose the kernel address any longer.

Care to rewrite the patch?

thanks,

Takashi

Quoted 21 lines
---
 sound/isa/gus/gus_mem.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
sound/isa/gus/gus_mem.c +1 -1
index 4ac76f4..63e790f 100644
@@ -306,7 +306,7 @@ static void snd_gf1_mem_info_read(struct snd_info_entry *entry,
 	used = 0;
 	for (block = alloc->first, i = 0; block; block = block->next, i++) {
 		used += block->size;
-		snd_iprintf(buffer, "Block %i at 0x%lx onboard 0x%x size %i (0x%x):\n", i, (long) block, block->ptr, block->size, block->size);
+		snd_iprintf(buffer, "Block %i at 0x%p onboard 0x%x size %i (0x%x):\n", i, block, block->ptr, block->size, block->size);
 		if (block->share ||
 		    block->share_id[0] || block->share_id[1] ||
 		    block->share_id[2] || block->share_id[3])
Signature · 1 line
2.11.0