mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <ahmad@a3f.at>
To: barebox@lists.infradead.org
Subject: [PATCH 2/3] usb: dwc2: fix mismatching argument to printf format specifier
Date: Sun, 28 Feb 2021 20:07:06 +0100	[thread overview]
Message-ID: <20210228190707.1451161-2-ahmad@a3f.at> (raw)
In-Reply-To: <20210228190707.1451161-1-ahmad@a3f.at>

%pad prints a DMA address out of a pointer to dma_addr_t.
Casting the dma_addr_t itself to void *, will lead to printf
dereferencing it and printing the first sizeof(dma_addr_t).

The dwc2 driver is the only one using %pad. Fix it.

Signed-off-by: Ahmad Fatoum <ahmad@a3f.at>
---
 drivers/usb/dwc2/gadget.c | 2 +-
 drivers/usb/dwc2/host.c   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c
index b8ec37be78b8..053a243d64c3 100644
--- a/drivers/usb/dwc2/gadget.c
+++ b/drivers/usb/dwc2/gadget.c
@@ -307,7 +307,7 @@ static void dwc2_gadget_start_req(struct dwc2 *dwc2,
 		dwc2_writel(dwc2, ureq->dma, dma_reg);
 
 		dwc2_dbg(dwc2, "%s: 0x%pad => 0x%08x\n",
-			 __func__, (void *)ureq->dma, dma_reg);
+			 __func__, &ureq->dma, dma_reg);
 	}
 
 	if (hs_ep->isochronous && hs_ep->interval == 1) {
diff --git a/drivers/usb/dwc2/host.c b/drivers/usb/dwc2/host.c
index 7a070d91f3bc..b5a51f566804 100644
--- a/drivers/usb/dwc2/host.c
+++ b/drivers/usb/dwc2/host.c
@@ -181,7 +181,7 @@ static int transfer_chunk(struct dwc2 *dwc2, u8 hc,
 	}
 
 	dwc2_dbg(dwc2, "chunk: pid=%d xfer_len=%u pkts=%u dma_addr=%pad\n",
-		 *pid, xfer_len, num_packets, (void *)dma_addr);
+		 *pid, xfer_len, num_packets, &dma_addr);
 
 	dwc2_writel(dwc2, dma_addr, HCDMA(hc));
 
-- 
2.30.0


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


  reply	other threads:[~2021-02-28 19:09 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-28 19:07 [PATCH 1/3] mtd: cfi-flash: fail gracefully instead of crashing on NULL page Ahmad Fatoum
2021-02-28 19:07 ` Ahmad Fatoum [this message]
2021-02-28 19:07 ` [PATCH 3/3] MIPS: qemu-malta: make barebox Malta images detectable Ahmad Fatoum
2021-03-01 15:57 ` [PATCH 1/3] mtd: cfi-flash: fail gracefully instead of crashing on NULL page Sascha Hauer

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=20210228190707.1451161-2-ahmad@a3f.at \
    --to=ahmad@a3f.at \
    --cc=barebox@lists.infradead.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