watchdog: stm32: replace "%p" with "%pK"

Message ID 20180706130808.22466-1-benjamin.gaignard@st.com
State New
Headers show
Series
  • watchdog: stm32: replace "%p" with "%pK"
Related show

Commit Message

Benjamin Gaignard July 6, 2018, 1:08 p.m.
The format specifier "%p" can leak kernel addresses.
Use "%pK" instead.

Signed-off-by: Benjamin Gaignard <benjamin.gaignard@st.com>

---
 drivers/watchdog/stm32_iwdg.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

-- 
2.15.0

--
To unsubscribe from this list: send the line "unsubscribe linux-watchdog" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Guenter Roeck July 7, 2018, 9:26 p.m. | #1
On Fri, Jul 06, 2018 at 03:08:08PM +0200, Benjamin Gaignard wrote:
> The format specifier "%p" can leak kernel addresses.

> Use "%pK" instead.

> 

The pointer has zero value either way. If the clock has a name,
it might make sense to display it. Otherwise just drop the pointer.

Guenter

> Signed-off-by: Benjamin Gaignard <benjamin.gaignard@st.com>

> ---

>  drivers/watchdog/stm32_iwdg.c | 2 +-

>  1 file changed, 1 insertion(+), 1 deletion(-)

> 

> diff --git a/drivers/watchdog/stm32_iwdg.c b/drivers/watchdog/stm32_iwdg.c

> index c97ad5619cb0..740f74a98644 100644

> --- a/drivers/watchdog/stm32_iwdg.c

> +++ b/drivers/watchdog/stm32_iwdg.c

> @@ -172,7 +172,7 @@ static int stm32_iwdg_probe(struct platform_device *pdev)

>  

>  	ret = clk_prepare_enable(clk);

>  	if (ret) {

> -		dev_err(&pdev->dev, "Unable to prepare clock %p\n", clk);

> +		dev_err(&pdev->dev, "Unable to prepare clock %pK\n", clk);

>  		return ret;

>  	}

>  

> -- 

> 2.15.0

> 

--
To unsubscribe from this list: send the line "unsubscribe linux-watchdog" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/drivers/watchdog/stm32_iwdg.c b/drivers/watchdog/stm32_iwdg.c
index c97ad5619cb0..740f74a98644 100644
--- a/drivers/watchdog/stm32_iwdg.c
+++ b/drivers/watchdog/stm32_iwdg.c
@@ -172,7 +172,7 @@  static int stm32_iwdg_probe(struct platform_device *pdev)
 
 	ret = clk_prepare_enable(clk);
 	if (ret) {
-		dev_err(&pdev->dev, "Unable to prepare clock %p\n", clk);
+		dev_err(&pdev->dev, "Unable to prepare clock %pK\n", clk);
 		return ret;
 	}