aboutsummaryrefslogtreecommitdiff
path: root/drivers/usb/host/sl811-hcd.c
diff options
context:
space:
mode:
authorManu Gautam <mgautam@codeaurora.org>2017-02-24 15:22:40 +0530
committerMoyster <oysterized@gmail.com>2018-11-27 16:09:55 +0100
commit513cef2c53c2b3846f6c571823412f514b6f66c7 (patch)
tree91c79e2c53b67916729fbfea3150bf7d9571bbdc /drivers/usb/host/sl811-hcd.c
parentb32e2d51665e3b6af648dec474db214b6312d967 (diff)
downloadandroid_kernel_m2note-513cef2c53c2b3846f6c571823412f514b6f66c7.tar.gz
usb: replace %p with %pK
Format specifier %p can leak kernel addresses while not valuing the kptr_restrict system settings. When kptr_restrict is set to (1), kernel pointers printed using the %pK format specifier will be replaced with 0's. Debugging Note : &pK prints only Zeros as address. If you need actual address information, write 0 to kptr_restrict. echo 0 > /proc/sys/kernel/kptr_restrict CRs-fixed: 1052849 Change-Id: I0e98145730380ea983fa8f46a28d15dd6c2c31df Signed-off-by: Manu Gautam <mgautam@codeaurora.org> Signed-off-by: Yasir Malik <ymalik@codeaurora.org> Signed-off-by: Kevin F. Haggerty <haggertk@lineageos.org>
Diffstat (limited to 'drivers/usb/host/sl811-hcd.c')
-rw-r--r--drivers/usb/host/sl811-hcd.c44
1 files changed, 22 insertions, 22 deletions
diff --git a/drivers/usb/host/sl811-hcd.c b/drivers/usb/host/sl811-hcd.c
index b4cad9346..94a3913ec 100644
--- a/drivers/usb/host/sl811-hcd.c
+++ b/drivers/usb/host/sl811-hcd.c
@@ -160,7 +160,7 @@ static void setup_packet(
sl811_write(sl811, bank + SL11H_HOSTCTLREG,
control | SL11H_HCTLMASK_OUT);
ep->length = 0;
- PACKET("SETUP qh%p\n", ep);
+ PACKET("SETUP qh%pK\n", ep);
}
/* STATUS finishes control requests, often after IN or OUT data packets */
@@ -190,7 +190,7 @@ static void status_packet(
control |= SL11H_HCTLMASK_OUT;
sl811_write(sl811, bank + SL11H_HOSTCTLREG, control);
ep->length = 0;
- PACKET("STATUS%s/%s qh%p\n", ep->nak_count ? "/retry" : "",
+ PACKET("STATUS%s/%s qh%pK\n", ep->nak_count ? "/retry" : "",
do_out ? "out" : "in", ep);
}
@@ -227,7 +227,7 @@ static void in_packet(
sl811_write(sl811, bank + SL11H_HOSTCTLREG, control);
ep->length = min_t(u32, len,
urb->transfer_buffer_length - urb->actual_length);
- PACKET("IN%s/%d qh%p len%d\n", ep->nak_count ? "/retry" : "",
+ PACKET("IN%s/%d qh%pK len%d\n", ep->nak_count ? "/retry" : "",
!!usb_gettoggle(urb->dev, ep->epnum, 0), ep, len);
}
@@ -270,7 +270,7 @@ static void out_packet(
sl811_write(sl811, bank + SL11H_HOSTCTLREG,
control | SL11H_HCTLMASK_OUT);
ep->length = len;
- PACKET("OUT%s/%d qh%p len%d\n", ep->nak_count ? "/retry" : "",
+ PACKET("OUT%s/%d qh%pK len%d\n", ep->nak_count ? "/retry" : "",
!!usb_gettoggle(urb->dev, ep->epnum, 1), ep, len);
}
@@ -338,7 +338,7 @@ static struct sl811h_ep *start(struct sl811 *sl811, u8 bank)
}
if (unlikely(list_empty(&ep->hep->urb_list))) {
- DBG("empty %p queue?\n", ep);
+ DBG("empty %pK queue?\n", ep);
return NULL;
}
@@ -391,7 +391,7 @@ static struct sl811h_ep *start(struct sl811 *sl811, u8 bank)
status_packet(sl811, ep, urb, bank, control);
break;
default:
- DBG("bad ep%p pid %02x\n", ep, ep->nextpid);
+ DBG("bad ep%pK pid %02x\n", ep, ep->nextpid);
ep = NULL;
}
return ep;
@@ -447,7 +447,7 @@ static void finish_request(
}
/* periodic deschedule */
- DBG("deschedule qh%d/%p branch %d\n", ep->period, ep, ep->branch);
+ DBG("deschedule qh%d/%pK branch %d\n", ep->period, ep, ep->branch);
for (i = ep->branch; i < PERIODIC_SIZE; i += ep->period) {
struct sl811h_ep *temp;
struct sl811h_ep **prev = &sl811->periodic[i];
@@ -486,7 +486,7 @@ done(struct sl811 *sl811, struct sl811h_ep *ep, u8 bank)
/* we can safely ignore NAKs */
if (status & SL11H_STATMASK_NAK) {
- // PACKET("...NAK_%02x qh%p\n", bank, ep);
+ // PACKET("...NAK_%02x qh%pK\n", bank, ep);
if (!ep->period)
ep->nak_count++;
ep->error_count = 0;
@@ -502,7 +502,7 @@ done(struct sl811 *sl811, struct sl811h_ep *ep, u8 bank)
ep->nak_count = ep->error_count = 0;
switch (ep->nextpid) {
case USB_PID_OUT:
- // PACKET("...ACK/out_%02x qh%p\n", bank, ep);
+ // PACKET("...ACK/out_%02x qh%pK\n", bank, ep);
urb->actual_length += ep->length;
usb_dotoggle(udev, ep->epnum, 1);
if (urb->actual_length
@@ -520,7 +520,7 @@ done(struct sl811 *sl811, struct sl811h_ep *ep, u8 bank)
}
break;
case USB_PID_IN:
- // PACKET("...ACK/in_%02x qh%p\n", bank, ep);
+ // PACKET("...ACK/in_%02x qh%pK\n", bank, ep);
buf = urb->transfer_buffer + urb->actual_length;
prefetchw(buf);
len = ep->maxpacket - sl811_read(sl811,
@@ -544,7 +544,7 @@ done(struct sl811 *sl811, struct sl811h_ep *ep, u8 bank)
}
break;
case USB_PID_SETUP:
- // PACKET("...ACK/setup_%02x qh%p\n", bank, ep);
+ // PACKET("...ACK/setup_%02x qh%pK\n", bank, ep);
if (urb->transfer_buffer_length == urb->actual_length)
ep->nextpid = USB_PID_ACK;
else if (usb_pipeout(urb->pipe)) {
@@ -556,14 +556,14 @@ done(struct sl811 *sl811, struct sl811h_ep *ep, u8 bank)
}
break;
case USB_PID_ACK:
- // PACKET("...ACK/status_%02x qh%p\n", bank, ep);
+ // PACKET("...ACK/status_%02x qh%pK\n", bank, ep);
urbstat = 0;
break;
}
/* STALL stops all transfers */
} else if (status & SL11H_STATMASK_STALL) {
- PACKET("...STALL_%02x qh%p\n", bank, ep);
+ PACKET("...STALL_%02x qh%pK\n", bank, ep);
ep->nak_count = ep->error_count = 0;
urbstat = -EPIPE;
@@ -576,7 +576,7 @@ done(struct sl811 *sl811, struct sl811h_ep *ep, u8 bank)
else
urbstat = -EPROTO;
ep->error_count = 0;
- PACKET("...3STRIKES_%02x %02x qh%p stat %d\n",
+ PACKET("...3STRIKES_%02x %02x qh%pK stat %d\n",
bank, status, ep, urbstat);
}
@@ -917,7 +917,7 @@ static int sl811h_urb_enqueue(
* to share the faster parts of the tree without needing
* dummy/placeholder nodes
*/
- DBG("schedule qh%d/%p branch %d\n", ep->period, ep, ep->branch);
+ DBG("schedule qh%d/%pK branch %d\n", ep->period, ep, ep->branch);
for (i = ep->branch; i < PERIODIC_SIZE; i += ep->period) {
struct sl811h_ep **prev = &sl811->periodic[i];
struct sl811h_ep *here = *prev;
@@ -1008,7 +1008,7 @@ static int sl811h_urb_dequeue(struct usb_hcd *hcd, struct urb *urb, int status)
if (urb)
finish_request(sl811, ep, urb, 0);
else
- VDBG("dequeue, urb %p active %s; wait4irq\n", urb,
+ VDBG("dequeue, urb %pK active %s; wait4irq\n", urb,
(sl811->active_a == ep) ? "A" : "B");
} else
retval = -EINVAL;
@@ -1029,7 +1029,7 @@ sl811h_endpoint_disable(struct usb_hcd *hcd, struct usb_host_endpoint *hep)
if (!list_empty(&hep->urb_list))
msleep(3);
if (!list_empty(&hep->urb_list))
- WARNING("ep %p not empty?\n", ep);
+ WARNING("ep %pK not empty?\n", ep);
kfree(ep);
hep->hcpriv = NULL;
@@ -1425,17 +1425,17 @@ static int proc_sl811h_show(struct seq_file *s, void *unused)
sl811_read(sl811, SL11H_SOFTMRREG) << 6);
}
- seq_printf(s, "A: qh%p ctl %02x sts %02x\n", sl811->active_a,
+ seq_printf(s, "A: qh%pK ctl %02x sts %02x\n", sl811->active_a,
sl811_read(sl811, SL811_EP_A(SL11H_HOSTCTLREG)),
sl811_read(sl811, SL811_EP_A(SL11H_PKTSTATREG)));
- seq_printf(s, "B: qh%p ctl %02x sts %02x\n", sl811->active_b,
+ seq_printf(s, "B: qh%pK ctl %02x sts %02x\n", sl811->active_b,
sl811_read(sl811, SL811_EP_B(SL11H_HOSTCTLREG)),
sl811_read(sl811, SL811_EP_B(SL11H_PKTSTATREG)));
seq_printf(s, "\n");
list_for_each_entry (ep, &sl811->async, schedule) {
struct urb *urb;
- seq_printf(s, "%s%sqh%p, ep%d%s, maxpacket %d"
+ seq_printf(s, "%s%sqh%pK, ep%d%s, maxpacket %d"
" nak %d err %d\n",
(ep == sl811->active_a) ? "(A) " : "",
(ep == sl811->active_b) ? "(B) " : "",
@@ -1450,7 +1450,7 @@ static int proc_sl811h_show(struct seq_file *s, void *unused)
ep->maxpacket,
ep->nak_count, ep->error_count);
list_for_each_entry (urb, &ep->hep->urb_list, urb_list) {
- seq_printf(s, " urb%p, %d/%d\n", urb,
+ seq_printf(s, " urb%pK, %d/%d\n", urb,
urb->actual_length,
urb->transfer_buffer_length);
}
@@ -1469,7 +1469,7 @@ static int proc_sl811h_show(struct seq_file *s, void *unused)
/* DUMB: prints shared entries multiple times */
do {
seq_printf(s,
- " %s%sqh%d/%p (%sdev%d ep%d%s max %d) "
+ " %s%sqh%d/%pK (%sdev%d ep%d%s max %d) "
"err %d\n",
(ep == sl811->active_a) ? "(A) " : "",
(ep == sl811->active_b) ? "(B) " : "",