usb: diag: change %p to %pK in debug messages

The format specifier %p can leak kernel addresses
while not valuing the kptr_restrict system settings.
Use %pK instead of %p, which also evaluates whether
kptr_restrict is set.

Bug: 31495348
Change-Id: I7392c2b444794234ebd685735566e7b4fa09c409
Signed-off-by: Min Chong <mchong@google.com>
This commit is contained in:
Min Chong 2016-10-11 17:12:00 -07:00 committed by Flex1911
parent b1a8c88774
commit 1feb1d1e7c

View file

@ -149,7 +149,7 @@ static int ghsic_data_alloc_requests(struct usb_ep *ep, struct list_head *head,
int i;
struct usb_request *req;
pr_debug("%s: ep:%s head:%p num:%d cb:%p", __func__,
pr_debug("%s: ep:%s head:%pK num:%d cb:%pK", __func__,
ep->name, head, num, cb);
for (i = 0; i < num; i++) {
@ -262,7 +262,7 @@ static int ghsic_data_receive(void *p, void *data, size_t len)
return -ENOTCONN;
}
pr_debug("%s: p:%p#%d skb_len:%d\n", __func__,
pr_debug("%s: p:%pK#%d skb_len:%d\n", __func__,
port, port->port_num, skb->len);
spin_lock_irqsave(&port->tx_lock, flags);
@ -306,7 +306,7 @@ static void ghsic_data_write_tomdm(struct work_struct *w)
}
while ((skb = __skb_dequeue(&port->rx_skb_q))) {
pr_debug("%s: port:%p tom:%lu pno:%d\n", __func__,
pr_debug("%s: port:%pK tom:%lu pno:%d\n", __func__,
port, port->to_modem, port->port_num);
info = (struct timestamp_info *)skb->cb;
@ -414,7 +414,7 @@ static void ghsic_data_start_rx(struct gdata_port *port)
struct timestamp_info *info;
unsigned int created;
pr_debug("%s: port:%p\n", __func__, port);
pr_debug("%s: port:%pK\n", __func__, port);
if (!port)
return;
@ -468,7 +468,7 @@ static void ghsic_data_start_io(struct gdata_port *port)
struct usb_ep *ep;
int ret;
pr_debug("%s: port:%p\n", __func__, port);
pr_debug("%s: port:%pK\n", __func__, port);
if (!port)
return;
@ -520,7 +520,7 @@ static void ghsic_data_connect_w(struct work_struct *w)
!test_bit(CH_READY, &port->bridge_sts))
return;
pr_debug("%s: port:%p\n", __func__, port);
pr_debug("%s: port:%pK\n", __func__, port);
ret = data_bridge_open(&port->brdg);
if (ret) {
@ -718,7 +718,7 @@ static int ghsic_data_port_alloc(unsigned port_num, enum gadget_type gtype)
platform_driver_register(pdrv);
pr_debug("%s: port:%p portno:%d\n", __func__, port, port_num);
pr_debug("%s: port:%pK portno:%d\n", __func__, port, port_num);
return 0;
}
@ -827,14 +827,14 @@ int ghsic_data_connect(void *gptr, int port_num)
ret = usb_ep_enable(port->in);
if (ret) {
pr_err("%s: usb_ep_enable failed eptype:IN ep:%p",
pr_err("%s: usb_ep_enable failed eptype:IN ep:%pK",
__func__, port->in);
goto fail;
}
ret = usb_ep_enable(port->out);
if (ret) {
pr_err("%s: usb_ep_enable failed eptype:OUT ep:%p",
pr_err("%s: usb_ep_enable failed eptype:OUT ep:%pK",
__func__, port->out);
usb_ep_disable(port->in);
goto fail;
@ -910,7 +910,7 @@ static void dbg_timestamp(char *event, struct sk_buff * skb)
write_lock_irqsave(&dbg_data.lck, flags);
scnprintf(dbg_data.buf[dbg_data.idx], DBG_DATA_MSG,
"%p %u[%s] %u %u %u %u %u %u\n",
"%pK %u[%s] %u %u %u %u %u %u\n",
skb, skb->len, event, info->created, info->rx_queued,
info->rx_done, info->rx_done_sent, info->tx_queued,
get_timestamp());
@ -984,7 +984,7 @@ static ssize_t ghsic_data_read_stats(struct file *file,
spin_lock_irqsave(&port->rx_lock, flags);
temp += scnprintf(buf + temp, DEBUG_DATA_BUF_SIZE - temp,
"\nName: %s\n"
"#PORT:%d port#: %p\n"
"#PORT:%d port#: %pK\n"
"data_ch_open: %d\n"
"data_ch_ready: %d\n"
"\n******UL INFO*****\n\n"