linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Fix some misuses of %x
@ 2019-04-19 13:21 Fuqian Huang
  2019-04-20 16:22 ` Randy Dunlap
  0 siblings, 1 reply; 2+ messages in thread
From: Fuqian Huang @ 2019-04-19 13:21 UTC (permalink / raw)
  To: linux-kernel; +Cc: Fuqian Huang

The pointers should be printed with %p or %px rather than
cast to long or unsigned long type and printed with %x.
Change %x to %p to print pointers.

Signed-off-by: Fuqian Huang <huangfq.daxian@gmail.com>
---
 drivers/atm/iphase.c               | 4 ++--
 drivers/misc/genwqe/card_debugfs.c | 4 ++--
 drivers/net/hippi/rrunner.c        | 4 ++--
 kernel/cgroup/debug.c              | 8 ++++----
 net/ax25/af_ax25.c                 | 4 ++--
 sound/isa/gus/gus_mem.c            | 2 +-
 6 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/drivers/atm/iphase.c b/drivers/atm/iphase.c
index 82532c299bb5..5278c57dce73 100644
--- a/drivers/atm/iphase.c
+++ b/drivers/atm/iphase.c
@@ -2826,8 +2826,8 @@ static int ia_ioctl(struct atm_dev *dev, unsigned int cmd, void __user *arg)
          case 0x6:
          {  
              ia_cmds.status = 0; 
-             printk("skb = 0x%lx\n", (long)skb_peek(&iadev->tx_backlog));
-             printk("rtn_q: 0x%lx\n",(long)ia_deque_rtn_q(&iadev->tx_return_q));
+             printk("skb = 0x%p\n", skb_peek(&iadev->tx_backlog));
+             printk("rtn_q: 0x%p\n",ia_deque_rtn_q(&iadev->tx_return_q));
          }
              break;
          case 0x8:
diff --git a/drivers/misc/genwqe/card_debugfs.c b/drivers/misc/genwqe/card_debugfs.c
index 7c713e01d198..6f7e39f07811 100644
--- a/drivers/misc/genwqe/card_debugfs.c
+++ b/drivers/misc/genwqe/card_debugfs.c
@@ -227,7 +227,7 @@ static int ddcb_info_show(struct seq_file *s, void *unused)
 	seq_puts(s, "DDCB QUEUE:\n");
 	seq_printf(s, "  ddcb_max:            %d\n"
 		   "  ddcb_daddr:          %016llx - %016llx\n"
-		   "  ddcb_vaddr:          %016llx\n"
+		   "  ddcb_vaddr:          %p\n"
 		   "  ddcbs_in_flight:     %u\n"
 		   "  ddcbs_max_in_flight: %u\n"
 		   "  ddcbs_completed:     %u\n"
@@ -237,7 +237,7 @@ static int ddcb_info_show(struct seq_file *s, void *unused)
 		   queue->ddcb_max, (long long)queue->ddcb_daddr,
 		   (long long)queue->ddcb_daddr +
 		   (queue->ddcb_max * DDCB_LENGTH),
-		   (long long)queue->ddcb_vaddr, queue->ddcbs_in_flight,
+		   queue->ddcb_vaddr, queue->ddcbs_in_flight,
 		   queue->ddcbs_max_in_flight, queue->ddcbs_completed,
 		   queue->return_on_busy, queue->wait_on_busy,
 		   cd->irqs_processed);
diff --git a/drivers/net/hippi/rrunner.c b/drivers/net/hippi/rrunner.c
index 029206e4da3b..0f7025f3a384 100644
--- a/drivers/net/hippi/rrunner.c
+++ b/drivers/net/hippi/rrunner.c
@@ -1298,11 +1298,11 @@ static void rr_dump(struct net_device *dev)
 	if (rrpriv->tx_skbuff[cons]){
 		len = min_t(int, 0x80, rrpriv->tx_skbuff[cons]->len);
 		printk("skbuff for cons %i is valid - dumping data (0x%x bytes - skbuff len 0x%x)\n", cons, len, rrpriv->tx_skbuff[cons]->len);
-		printk("mode 0x%x, size 0x%x,\n phys %08Lx, skbuff-addr %08lx, truesize 0x%x\n",
+		printk("mode 0x%x, size 0x%x,\n phys %08Lx, skbuff-addr %p, truesize 0x%x\n",
 		       rrpriv->tx_ring[cons].mode,
 		       rrpriv->tx_ring[cons].size,
 		       (unsigned long long) rrpriv->tx_ring[cons].addr.addrlo,
-		       (unsigned long)rrpriv->tx_skbuff[cons]->data,
+		       rrpriv->tx_skbuff[cons]->data,
 		       (unsigned int)rrpriv->tx_skbuff[cons]->truesize);
 		for (i = 0; i < len; i++){
 			if (!(i & 7))
diff --git a/kernel/cgroup/debug.c b/kernel/cgroup/debug.c
index 5f1b87330bee..80aa3f027ac3 100644
--- a/kernel/cgroup/debug.c
+++ b/kernel/cgroup/debug.c
@@ -64,8 +64,8 @@ static int current_css_set_read(struct seq_file *seq, void *v)
 		css = cset->subsys[ss->id];
 		if (!css)
 			continue;
-		seq_printf(seq, "%2d: %-4s\t- %lx[%d]\n", ss->id, ss->name,
-			  (unsigned long)css, css->id);
+		seq_printf(seq, "%2d: %-4s\t- %p[%d]\n", ss->id, ss->name,
+			  css, css->id);
 	}
 	rcu_read_unlock();
 	spin_unlock_irq(&css_set_lock);
@@ -224,8 +224,8 @@ static int cgroup_subsys_states_read(struct seq_file *seq, void *v)
 		if (css->parent)
 			snprintf(pbuf, sizeof(pbuf) - 1, " P=%d",
 				 css->parent->id);
-		seq_printf(seq, "%2d: %-4s\t- %lx[%d] %d%s\n", ss->id, ss->name,
-			  (unsigned long)css, css->id,
+		seq_printf(seq, "%2d: %-4s\t- %p[%d] %d%s\n", ss->id, ss->name,
+			  css, css->id,
 			  atomic_read(&css->online_cnt), pbuf);
 	}
 
diff --git a/net/ax25/af_ax25.c b/net/ax25/af_ax25.c
index 5d01edf8d819..90c2831297dd 100644
--- a/net/ax25/af_ax25.c
+++ b/net/ax25/af_ax25.c
@@ -1888,8 +1888,8 @@ static int ax25_info_show(struct seq_file *seq, void *v)
 	 * magic dev src_addr dest_addr,digi1,digi2,.. st vs vr va t1 t1 t2 t2 t3 t3 idle idle n2 n2 rtt window paclen Snd-Q Rcv-Q inode
 	 */
 
-	seq_printf(seq, "%8.8lx %s %s%s ",
-		   (long) ax25,
+	seq_printf(seq, "%p %s %s%s ",
+		   ax25,
 		   ax25->ax25_dev == NULL? "???" : ax25->ax25_dev->dev->name,
 		   ax2asc(buf, &ax25->source_addr),
 		   ax25->iamdigi? "*":"");
diff --git a/sound/isa/gus/gus_mem.c b/sound/isa/gus/gus_mem.c
index 4ac76f46dd76..63e790fbf066 100644
--- a/sound/isa/gus/gus_mem.c
+++ b/sound/isa/gus/gus_mem.c
@@ -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])
-- 
2.11.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] Fix some misuses of %x
  2019-04-19 13:21 [PATCH] Fix some misuses of %x Fuqian Huang
@ 2019-04-20 16:22 ` Randy Dunlap
  0 siblings, 0 replies; 2+ messages in thread
From: Randy Dunlap @ 2019-04-20 16:22 UTC (permalink / raw)
  To: Fuqian Huang, linux-kernel; +Cc: Andrew Morton

On 4/19/19 6:21 AM, Fuqian Huang wrote:
> The pointers should be printed with %p or %px rather than
> cast to long or unsigned long type and printed with %x.
> Change %x to %p to print pointers.
> 
> Signed-off-by: Fuqian Huang <huangfq.daxian@gmail.com>

Hi,

You will need to send this patch (or patch set/patch series) to the
appropriate subsystem maintainers and their respective mailing lists.
Maintainers don't browse the linux-kernel mailing list to search or
pick up patches.

From Documentation/process/submitting-patches.rst:

5) Select the recipients for your patch
---------------------------------------

You should always copy the appropriate subsystem maintainer(s) on any patch
to code that they maintain; look through the MAINTAINERS file and the
source code revision history to see who those maintainers are.  The
script scripts/get_maintainer.pl can be very useful at this step.  If you
cannot find a maintainer for the subsystem you are working on, Andrew
Morton (akpm@linux-foundation.org) serves as a maintainer of last resort.

You should also normally choose at least one mailing list to receive a copy
of your patch set.  linux-kernel@vger.kernel.org functions as a list of
last resort, but the volume on that list has caused a number of developers
to tune it out.  Look in the MAINTAINERS file for a subsystem-specific
list; your patch will probably get more attention there.  Please do not
spam unrelated lists, though.

Many kernel-related lists are hosted on vger.kernel.org; you can find a
list of them at http://vger.kernel.org/vger-lists.html.  There are
kernel-related lists hosted elsewhere as well, though.


Thanks.

> ---
>  drivers/atm/iphase.c               | 4 ++--
>  drivers/misc/genwqe/card_debugfs.c | 4 ++--
>  drivers/net/hippi/rrunner.c        | 4 ++--
>  kernel/cgroup/debug.c              | 8 ++++----
>  net/ax25/af_ax25.c                 | 4 ++--
>  sound/isa/gus/gus_mem.c            | 2 +-
>  6 files changed, 13 insertions(+), 13 deletions(-)
> 
> diff --git a/drivers/atm/iphase.c b/drivers/atm/iphase.c
> index 82532c299bb5..5278c57dce73 100644
> --- a/drivers/atm/iphase.c
> +++ b/drivers/atm/iphase.c
> @@ -2826,8 +2826,8 @@ static int ia_ioctl(struct atm_dev *dev, unsigned int cmd, void __user *arg)
>           case 0x6:
>           {  
>               ia_cmds.status = 0; 
> -             printk("skb = 0x%lx\n", (long)skb_peek(&iadev->tx_backlog));
> -             printk("rtn_q: 0x%lx\n",(long)ia_deque_rtn_q(&iadev->tx_return_q));
> +             printk("skb = 0x%p\n", skb_peek(&iadev->tx_backlog));
> +             printk("rtn_q: 0x%p\n",ia_deque_rtn_q(&iadev->tx_return_q));
>           }
>               break;
>           case 0x8:
> diff --git a/drivers/misc/genwqe/card_debugfs.c b/drivers/misc/genwqe/card_debugfs.c
> index 7c713e01d198..6f7e39f07811 100644
> --- a/drivers/misc/genwqe/card_debugfs.c
> +++ b/drivers/misc/genwqe/card_debugfs.c
> @@ -227,7 +227,7 @@ static int ddcb_info_show(struct seq_file *s, void *unused)
>  	seq_puts(s, "DDCB QUEUE:\n");
>  	seq_printf(s, "  ddcb_max:            %d\n"
>  		   "  ddcb_daddr:          %016llx - %016llx\n"
> -		   "  ddcb_vaddr:          %016llx\n"
> +		   "  ddcb_vaddr:          %p\n"
>  		   "  ddcbs_in_flight:     %u\n"
>  		   "  ddcbs_max_in_flight: %u\n"
>  		   "  ddcbs_completed:     %u\n"
> @@ -237,7 +237,7 @@ static int ddcb_info_show(struct seq_file *s, void *unused)
>  		   queue->ddcb_max, (long long)queue->ddcb_daddr,
>  		   (long long)queue->ddcb_daddr +
>  		   (queue->ddcb_max * DDCB_LENGTH),
> -		   (long long)queue->ddcb_vaddr, queue->ddcbs_in_flight,
> +		   queue->ddcb_vaddr, queue->ddcbs_in_flight,
>  		   queue->ddcbs_max_in_flight, queue->ddcbs_completed,
>  		   queue->return_on_busy, queue->wait_on_busy,
>  		   cd->irqs_processed);
> diff --git a/drivers/net/hippi/rrunner.c b/drivers/net/hippi/rrunner.c
> index 029206e4da3b..0f7025f3a384 100644
> --- a/drivers/net/hippi/rrunner.c
> +++ b/drivers/net/hippi/rrunner.c
> @@ -1298,11 +1298,11 @@ static void rr_dump(struct net_device *dev)
>  	if (rrpriv->tx_skbuff[cons]){
>  		len = min_t(int, 0x80, rrpriv->tx_skbuff[cons]->len);
>  		printk("skbuff for cons %i is valid - dumping data (0x%x bytes - skbuff len 0x%x)\n", cons, len, rrpriv->tx_skbuff[cons]->len);
> -		printk("mode 0x%x, size 0x%x,\n phys %08Lx, skbuff-addr %08lx, truesize 0x%x\n",
> +		printk("mode 0x%x, size 0x%x,\n phys %08Lx, skbuff-addr %p, truesize 0x%x\n",
>  		       rrpriv->tx_ring[cons].mode,
>  		       rrpriv->tx_ring[cons].size,
>  		       (unsigned long long) rrpriv->tx_ring[cons].addr.addrlo,
> -		       (unsigned long)rrpriv->tx_skbuff[cons]->data,
> +		       rrpriv->tx_skbuff[cons]->data,
>  		       (unsigned int)rrpriv->tx_skbuff[cons]->truesize);
>  		for (i = 0; i < len; i++){
>  			if (!(i & 7))
> diff --git a/kernel/cgroup/debug.c b/kernel/cgroup/debug.c
> index 5f1b87330bee..80aa3f027ac3 100644
> --- a/kernel/cgroup/debug.c
> +++ b/kernel/cgroup/debug.c
> @@ -64,8 +64,8 @@ static int current_css_set_read(struct seq_file *seq, void *v)
>  		css = cset->subsys[ss->id];
>  		if (!css)
>  			continue;
> -		seq_printf(seq, "%2d: %-4s\t- %lx[%d]\n", ss->id, ss->name,
> -			  (unsigned long)css, css->id);
> +		seq_printf(seq, "%2d: %-4s\t- %p[%d]\n", ss->id, ss->name,
> +			  css, css->id);
>  	}
>  	rcu_read_unlock();
>  	spin_unlock_irq(&css_set_lock);
> @@ -224,8 +224,8 @@ static int cgroup_subsys_states_read(struct seq_file *seq, void *v)
>  		if (css->parent)
>  			snprintf(pbuf, sizeof(pbuf) - 1, " P=%d",
>  				 css->parent->id);
> -		seq_printf(seq, "%2d: %-4s\t- %lx[%d] %d%s\n", ss->id, ss->name,
> -			  (unsigned long)css, css->id,
> +		seq_printf(seq, "%2d: %-4s\t- %p[%d] %d%s\n", ss->id, ss->name,
> +			  css, css->id,
>  			  atomic_read(&css->online_cnt), pbuf);
>  	}
>  
> diff --git a/net/ax25/af_ax25.c b/net/ax25/af_ax25.c
> index 5d01edf8d819..90c2831297dd 100644
> --- a/net/ax25/af_ax25.c
> +++ b/net/ax25/af_ax25.c
> @@ -1888,8 +1888,8 @@ static int ax25_info_show(struct seq_file *seq, void *v)
>  	 * magic dev src_addr dest_addr,digi1,digi2,.. st vs vr va t1 t1 t2 t2 t3 t3 idle idle n2 n2 rtt window paclen Snd-Q Rcv-Q inode
>  	 */
>  
> -	seq_printf(seq, "%8.8lx %s %s%s ",
> -		   (long) ax25,
> +	seq_printf(seq, "%p %s %s%s ",
> +		   ax25,
>  		   ax25->ax25_dev == NULL? "???" : ax25->ax25_dev->dev->name,
>  		   ax2asc(buf, &ax25->source_addr),
>  		   ax25->iamdigi? "*":"");
> diff --git a/sound/isa/gus/gus_mem.c b/sound/isa/gus/gus_mem.c
> index 4ac76f46dd76..63e790fbf066 100644
> --- a/sound/isa/gus/gus_mem.c
> +++ b/sound/isa/gus/gus_mem.c
> @@ -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])
> 


-- 
~Randy

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-04-20 16:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-19 13:21 [PATCH] Fix some misuses of %x Fuqian Huang
2019-04-20 16:22 ` Randy Dunlap

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).