habanalabs: use %px instead of %p in error print
PATCH 1/1 habanalabs: use %px instead of %p in error print
When parsing the address of an internal command buffer, the driver prints an error if the buffer's address is not in the range of the device's DRAM or SRAM memory address space.
Use %px to print the real address that the user gave the driver and not a hashed value, so the user will get a clue regarding the origin of his error.
Note that if the print occurs, the pointer that is printed is a user's virtual address and not some kind of physical address.
--- drivers/misc/habanalabs/goya/goya.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/misc/habanalabs/goya/goya.c +1 -1
@@ -4293,7 +4293,7 @@ static int goya_parse_cb_no_ext_quque(struct hl_device *hdev,return 0 ;dev_err (hdev->dev, -"Internal CB address %p + 0x%x is not in SRAM nor in DRAM\n" , +"Internal CB address %px + 0x%x is not in SRAM nor in DRAM\n" , parser->user_cb, parser->user_cb_size);return -EFAULT ;
Signature · 1 line
2.18.0
Quoted 11 lines · Oded Gabbay
When parsing the address of an internal command buffer, the driver prints an error if the buffer's address is not in the range of the device's DRAM or SRAM memory address space.
Use %px to print the real address that the user gave the driver and not a hashed value, so the user will get a clue regarding the origin of his error.
Note that if the print occurs, the pointer that is printed is a user's virtual address and not some kind of physical address.
Err, which virtual address space is this? If this is mapped into the kernel's virtual address space, this should not be %px...
-Kees
Quoted 23 lines
Suggested-by Joe Perches <[email protected]>Signed-off-by Oded Gabbay <[email protected]>--- drivers/misc/habanalabs/goya/goya.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/misc/habanalabs/goya/goya.c +1
-2@@ -4293,7 +4293,7 @@ static int goya_parse_cb_no_ext_quque(struct hl_device *hdev,return 0 ;dev_err (hdev->dev, -"Internal CB address %p + 0x%x is not in SRAM nor in DRAM\n" , +"Internal CB address %px + 0x%x is not in SRAM nor in DRAM\n" , parser->user_cb, parser->user_cb_size);return -EFAULT ; --2.18.0
Signature · 1 line
Kees Cook
Quoted 11 lines · Kees Cook
Quoted 9 lines · Oded Gabbay
When parsing the address of an internal command buffer, the driver prints an error if the buffer's address is not in the range of the device's DRAM or SRAM memory address space.
Use %px to print the real address that the user gave the driver and not a hashed value, so the user will get a clue regarding the origin of his error.
Quoted 5 lines
Quoted 2 lines
Note that if the print occurs, the pointer that is printed is a user's virtual address and not some kind of physical address.
Err, which virtual address space is this? If this is mapped into the kernel's virtual address space, this should not be %px...
No, it's not mapped to kernel in any way.
It's supposed to be an address in the device's address space. As this is an error message, it's either a wrong address in the device's address space, or it's a user-space virtual address. Oded
Quoted 30 lines
-Kees
Quoted 21 lines
Suggested-by Joe Perches <[email protected]>Signed-off-by Oded Gabbay <[email protected]>--- drivers/misc/habanalabs/goya/goya.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/misc/habanalabs/goya/goya.c +1
-2@@ -4293,7 +4293,7 @@ static int goya_parse_cb_no_ext_quque(struct hl_device *hdev,return 0 ;dev_err (hdev->dev, -"Internal CB address %p + 0x%x is not in SRAM nor in DRAM\n" , +"Internal CB address %px + 0x%x is not in SRAM nor in DRAM\n" , parser->user_cb, parser->user_cb_size);return -EFAULT ; --Quoted 2 lines
2.18.0
--
Kees Cook
Quoted 16 lines · Oded Gabbay
Quoted 14 lines · Kees Cook
Quoted 11 lines · Oded Gabbay
When parsing the address of an internal command buffer, the driver prints an error if the buffer's address is not in the range of the device's DRAM or SRAM memory address space.
Use %px to print the real address that the user gave the driver and not a hashed value, so the user will get a clue regarding the origin of his error.
Note that if the print occurs, the pointer that is printed is a user's virtual address and not some kind of physical address.
Quoted 6 lines
Quoted 2 lines
Err, which virtual address space is this? If this is mapped into the kernel's virtual address space, this should not be %px...
No, it's not mapped to kernel in any way.
It's supposed to be an address in the device's address space. As this is an error message, it's either a wrong address in the device's address space, or it's a user-space virtual address.
Okay, thanks! :)
Signature · 1 line
Kees Cook