Skip to content

Commit 76549ad

Browse files
t-8chmartinkpetersen
authored andcommitted
scsi: 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 ad67b74 ("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. Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de> Link: https://lore.kernel.org/r/20250611-restricted-pointers-scsi-v1-1-fe31bfbc4910@linutronix.de Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
1 parent b1ba03c commit 76549ad

3 files changed

Lines changed: 7 additions & 7 deletions

File tree

drivers/scsi/hisi_sas/hisi_sas_v2_hw.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2401,7 +2401,7 @@ static void slot_complete_v2_hw(struct hisi_hba *hisi_hba,
24012401
slot_err_v2_hw(hisi_hba, task, slot, 2);
24022402

24032403
if (ts->stat != SAS_DATA_UNDERRUN)
2404-
dev_info(dev, "erroneous completion iptt=%d task=%pK dev id=%d CQ hdr: 0x%x 0x%x 0x%x 0x%x Error info: 0x%x 0x%x 0x%x 0x%x\n",
2404+
dev_info(dev, "erroneous completion iptt=%d task=%p dev id=%d CQ hdr: 0x%x 0x%x 0x%x 0x%x Error info: 0x%x 0x%x 0x%x 0x%x\n",
24052405
slot->idx, task, sas_dev->device_id,
24062406
complete_hdr->dw0, complete_hdr->dw1,
24072407
complete_hdr->act, complete_hdr->dw3,
@@ -2467,7 +2467,7 @@ static void slot_complete_v2_hw(struct hisi_hba *hisi_hba,
24672467
spin_lock_irqsave(&task->task_state_lock, flags);
24682468
if (task->task_state_flags & SAS_TASK_STATE_ABORTED) {
24692469
spin_unlock_irqrestore(&task->task_state_lock, flags);
2470-
dev_info(dev, "slot complete: task(%pK) aborted\n", task);
2470+
dev_info(dev, "slot complete: task(%p) aborted\n", task);
24712471
return;
24722472
}
24732473
task->task_state_flags |= SAS_TASK_STATE_DONE;
@@ -2478,7 +2478,7 @@ static void slot_complete_v2_hw(struct hisi_hba *hisi_hba,
24782478
spin_lock_irqsave(&device->done_lock, flags);
24792479
if (test_bit(SAS_HA_FROZEN, &ha->state)) {
24802480
spin_unlock_irqrestore(&device->done_lock, flags);
2481-
dev_info(dev, "slot complete: task(%pK) ignored\n",
2481+
dev_info(dev, "slot complete: task(%p) ignored\n",
24822482
task);
24832483
return;
24842484
}

drivers/scsi/hisi_sas/hisi_sas_v3_hw.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2409,7 +2409,7 @@ static void slot_complete_v3_hw(struct hisi_hba *hisi_hba,
24092409

24102410
if (slot_err_v3_hw(hisi_hba, task, slot)) {
24112411
if (ts->stat != SAS_DATA_UNDERRUN)
2412-
dev_info(dev, "erroneous completion iptt=%d task=%pK dev id=%d addr=%016llx CQ hdr: 0x%x 0x%x 0x%x 0x%x Error info: 0x%x 0x%x 0x%x 0x%x\n",
2412+
dev_info(dev, "erroneous completion iptt=%d task=%p dev id=%d addr=%016llx CQ hdr: 0x%x 0x%x 0x%x 0x%x Error info: 0x%x 0x%x 0x%x 0x%x\n",
24132413
slot->idx, task, sas_dev->device_id,
24142414
SAS_ADDR(device->sas_addr),
24152415
dw0, dw1, complete_hdr->act, dw3,
@@ -2470,7 +2470,7 @@ static void slot_complete_v3_hw(struct hisi_hba *hisi_hba,
24702470
spin_lock_irqsave(&task->task_state_lock, flags);
24712471
if (task->task_state_flags & SAS_TASK_STATE_ABORTED) {
24722472
spin_unlock_irqrestore(&task->task_state_lock, flags);
2473-
dev_info(dev, "slot complete: task(%pK) aborted\n", task);
2473+
dev_info(dev, "slot complete: task(%p) aborted\n", task);
24742474
return;
24752475
}
24762476
task->task_state_flags |= SAS_TASK_STATE_DONE;
@@ -2481,7 +2481,7 @@ static void slot_complete_v3_hw(struct hisi_hba *hisi_hba,
24812481
spin_lock_irqsave(&device->done_lock, flags);
24822482
if (test_bit(SAS_HA_FROZEN, &ha->state)) {
24832483
spin_unlock_irqrestore(&device->done_lock, flags);
2484-
dev_info(dev, "slot complete: task(%pK) ignored\n",
2484+
dev_info(dev, "slot complete: task(%p) ignored\n",
24852485
task);
24862486
return;
24872487
}

drivers/scsi/scsi_debug.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8770,7 +8770,7 @@ static int sdebug_add_store(void)
87708770
dif_size = sdebug_store_sectors * sizeof(struct t10_pi_tuple);
87718771
sip->dif_storep = vmalloc(dif_size);
87728772

8773-
pr_info("dif_storep %u bytes @ %pK\n", dif_size,
8773+
pr_info("dif_storep %u bytes @ %p\n", dif_size,
87748774
sip->dif_storep);
87758775

87768776
if (!sip->dif_storep) {

0 commit comments

Comments
 (0)