mirror of https://github.com/torvalds/linux.git
spi: loopback-test: Don't use %pK through printk
In the past %pK was preferable to %p as it would not leak raw pointer
values into the kernel log.
Since commit ad67b74d24 ("printk: hash addresses printed with %p")
the regular %p has been improved to avoid this issue.
Furthermore, restricted pointers ("%pK") were never meant to be used
through printk(). They can still unintentionally leak raw pointers or
acquire sleeping locks in atomic contexts.
Switch to the regular pointer formatting which is safer and
easier to reason about.
There are still a few users of %pK left, but these use it through seq_file,
for which its usage is safe.
Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
Link: https://patch.msgid.link/20250811-restricted-pointers-spi-v1-1-32c47f954e4d@linutronix.de
Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
528a813a5d
commit
b832b19318
|
|
@ -446,7 +446,7 @@ static void spi_test_dump_message(struct spi_device *spi,
|
||||||
int i;
|
int i;
|
||||||
u8 b;
|
u8 b;
|
||||||
|
|
||||||
dev_info(&spi->dev, " spi_msg@%pK\n", msg);
|
dev_info(&spi->dev, " spi_msg@%p\n", msg);
|
||||||
if (msg->status)
|
if (msg->status)
|
||||||
dev_info(&spi->dev, " status: %i\n",
|
dev_info(&spi->dev, " status: %i\n",
|
||||||
msg->status);
|
msg->status);
|
||||||
|
|
@ -456,15 +456,15 @@ static void spi_test_dump_message(struct spi_device *spi,
|
||||||
msg->actual_length);
|
msg->actual_length);
|
||||||
|
|
||||||
list_for_each_entry(xfer, &msg->transfers, transfer_list) {
|
list_for_each_entry(xfer, &msg->transfers, transfer_list) {
|
||||||
dev_info(&spi->dev, " spi_transfer@%pK\n", xfer);
|
dev_info(&spi->dev, " spi_transfer@%p\n", xfer);
|
||||||
dev_info(&spi->dev, " len: %i\n", xfer->len);
|
dev_info(&spi->dev, " len: %i\n", xfer->len);
|
||||||
dev_info(&spi->dev, " tx_buf: %pK\n", xfer->tx_buf);
|
dev_info(&spi->dev, " tx_buf: %p\n", xfer->tx_buf);
|
||||||
if (dump_data && xfer->tx_buf)
|
if (dump_data && xfer->tx_buf)
|
||||||
spi_test_print_hex_dump(" TX: ",
|
spi_test_print_hex_dump(" TX: ",
|
||||||
xfer->tx_buf,
|
xfer->tx_buf,
|
||||||
xfer->len);
|
xfer->len);
|
||||||
|
|
||||||
dev_info(&spi->dev, " rx_buf: %pK\n", xfer->rx_buf);
|
dev_info(&spi->dev, " rx_buf: %p\n", xfer->rx_buf);
|
||||||
if (dump_data && xfer->rx_buf)
|
if (dump_data && xfer->rx_buf)
|
||||||
spi_test_print_hex_dump(" RX: ",
|
spi_test_print_hex_dump(" RX: ",
|
||||||
xfer->rx_buf,
|
xfer->rx_buf,
|
||||||
|
|
@ -558,7 +558,7 @@ static int spi_check_rx_ranges(struct spi_device *spi,
|
||||||
/* if still not found then something has modified too much */
|
/* if still not found then something has modified too much */
|
||||||
/* we could list the "closest" transfer here... */
|
/* we could list the "closest" transfer here... */
|
||||||
dev_err(&spi->dev,
|
dev_err(&spi->dev,
|
||||||
"loopback strangeness - rx changed outside of allowed range at: %pK\n",
|
"loopback strangeness - rx changed outside of allowed range at: %p\n",
|
||||||
addr);
|
addr);
|
||||||
/* do not return, only set ret,
|
/* do not return, only set ret,
|
||||||
* so that we list all addresses
|
* so that we list all addresses
|
||||||
|
|
@ -696,7 +696,7 @@ static int spi_test_translate(struct spi_device *spi,
|
||||||
}
|
}
|
||||||
|
|
||||||
dev_err(&spi->dev,
|
dev_err(&spi->dev,
|
||||||
"PointerRange [%pK:%pK[ not in range [%pK:%pK[ or [%pK:%pK[\n",
|
"PointerRange [%p:%p[ not in range [%p:%p[ or [%p:%p[\n",
|
||||||
*ptr, *ptr + len,
|
*ptr, *ptr + len,
|
||||||
RX(0), RX(SPI_TEST_MAX_SIZE),
|
RX(0), RX(SPI_TEST_MAX_SIZE),
|
||||||
TX(0), TX(SPI_TEST_MAX_SIZE));
|
TX(0), TX(SPI_TEST_MAX_SIZE));
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue