Skip to contentSkip to conversation

pinctrl: imx: off by one in imx_pinconf_group_dbg_show()

PATCH In review Dan Carpenter 5 participants 8 messages Jul 19, 2018 – Jul 30, 2018

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 pinctrl: imx: off by one in imx_pinconf_group_dbg_show()

The > should really be >= here. It's harmless because pinctrl_generic_get_group() will return a NULL if group is invalid.

Fixes ae75ff814538 ("pinctrl: pinctrl-imx: add imx pinctrl core driver")

---

drivers/pinctrl/freescale/pinctrl-imx.c +1 -1
index 1c6bb15579e1..b04edc22dad7 100644
@@ -383,7 +383,7 @@ static void imx_pinconf_group_dbg_show(struct pinctrl_dev *pctldev,
 	const char *name;
 	int i, ret;
 
-	if (group > pctldev->num_groups)
+	if (group >= pctldev->num_groups)
 		return;
 
 	seq_puts(s, "\n");
Reviewed-by on v1 1/1
#1 lore raw
Quoted 6 lines · Dan Carpenter

The > should really be >= here. It's harmless because pinctrl_generic_get_group() will return a NULL if group is invalid.

Fixes ae75ff814538 ("pinctrl: pinctrl-imx: add imx pinctrl core driver")
Quoted 17 lines

---

drivers/pinctrl/freescale/pinctrl-imx.c +1 -1
index 1c6bb15579e1..b04edc22dad7 100644
@@ -383,7 +383,7 @@ static void imx_pinconf_group_dbg_show(struct
 pinctrl_dev *pctldev,
 	const char *name;
 	int i, ret;
 
-	if (group > pctldev->num_groups)
+	if (group >= pctldev->num_groups)
 		return;
 

seq_puts(s, "\n");

#3 lore raw
In reply to Dan Carpenter
Quoted 10 lines · Linus Walleij
Quoted 6 lines · Dan Carpenter

The > should really be >= here. It's harmless because pinctrl_generic_get_group() will return a NULL if group is invalid.

Fixes ae75ff814538 ("pinctrl: pinctrl-imx: add imx pinctrl core driver")

Patch applied.

I see that you applied the imx_pinconf_group_dbg_show patch, but not the one specific to imx1 earlier in this thread. These are orthogonal and so both should be applied.

Best regards
Uwe

Signature · 6 lines
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
maintainer
#4 lore raw
In reply to Dan Carpenter
Quoted 24 lines

-----Original Message-----
From: Uwe Kleine-König [mailto:[email protected]]
Sent: Monday, July 30, 2018 2:42 PM
To: Linus Walleij <[email protected]>
Cc: Dan Carpenter <[email protected]>; A.s. Dong <[email protected]>; Fabio Estevam <[email protected]>; kernel- [email protected]; Stefan Agner <[email protected]>; open list:GPIO SUBSYSTEM <[email protected]>; Sascha Hauer <[email protected]>; Shawn Guo <[email protected]>
Subject: Re: [PATCH] pinctrl: imx: off by one in imx_pinconf_group_dbg_show()

Quoted 1 line · Linus Walleij

On Thu, Jul 19, 2018 at 10:17 AM Dan Carpenter

Quoted 9 lines · <[email protected]> wrote:
Quoted 8 lines

The > should really be >= here. It's harmless because pinctrl_generic_get_group() will return a NULL if group is invalid.

Fixes ae75ff814538 ("pinctrl: pinctrl-imx: add imx pinctrl core

driver")

Quoted 6 lines
Quoted 1 line

Patch applied.

I see that you applied the imx_pinconf_group_dbg_show patch, but not the one specific to imx1 earlier in this thread. These are orthogonal and so both should be applied.

Right.

BTW just let you know, unlike that patch, this one is just a simple improvement and don't have to go to stable tree.

Regards
Dong Aisheng

Quoted 11 lines

Best regards
Uwe

--
Pengutronix e.K. | Uwe Kleine-König |
Industrial Linux Solutions |
https://emea01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fww
w.pengutronix.de%2F&amp;data=02%7C01%7Caisheng.dong%40nxp.com%7 C4d3365909e4347b199f608d5f5e787e5%7C686ea1d3bc2b4c6fa92cd99c5c3016 35%7C0%7C0%7C636685297127964877&amp;sdata=RpfBCPK%2Fuom9gUGN wPCAY%2FR8nK67S66ryT9z5g3HM1k%3D&amp;reserved=0 |

--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#5 lore raw
In reply to Dan Carpenter
Quoted 10 lines · Uwe Kleine-König
Quoted 9 lines · Linus Walleij
Quoted 6 lines · Dan Carpenter

The > should really be >= here. It's harmless because pinctrl_generic_get_group() will return a NULL if group is invalid.

Fixes ae75ff814538 ("pinctrl: pinctrl-imx: add imx pinctrl core driver")
Quoted 5 lines
Quoted 1 line

Patch applied.

I see that you applied the imx_pinconf_group_dbg_show patch, but not the one specific to imx1 earlier in this thread. These are orthogonal and so both should be applied.

Oh I'm sorry if I missed something... which subject does the missing patch have?

Yours,
Linus Walleij
--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#6 lore raw
In reply to Dan Carpenter
Quoted 12 lines · Linus Walleij
Quoted 10 lines · Uwe Kleine-König
Quoted 9 lines · Linus Walleij
Quoted 6 lines · Dan Carpenter

The > should really be >= here. It's harmless because pinctrl_generic_get_group() will return a NULL if group is invalid.

Fixes ae75ff814538 ("pinctrl: pinctrl-imx: add imx pinctrl core driver")
Quoted 8 lines
Quoted 5 lines
Quoted 1 line

Patch applied.

I see that you applied the imx_pinconf_group_dbg_show patch, but not the one specific to imx1 earlier in this thread. These are orthogonal and so both should be applied.

Oh I'm sorry if I missed something... which subject does the missing patch have?

The subject is:

pinctrl: freescale: off by one in imx1_pinconf_group_dbg_show()

(Note it only differs by s/imx/imx1/ from the patch you already took.)

Best regards
Uwe

Signature · 6 lines
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#7 lore raw
In reply to Dan Carpenter
Quoted 31 lines · A.s. Dong
Quoted 24 lines

-----Original Message-----
From: Uwe Kleine-König [mailto:[email protected]]
Sent: Monday, July 30, 2018 2:42 PM
To: Linus Walleij <[email protected]>
Cc: Dan Carpenter <[email protected]>; A.s. Dong <[email protected]>; Fabio Estevam <[email protected]>; kernel- [email protected]; Stefan Agner <[email protected]>; open list:GPIO SUBSYSTEM <[email protected]>; Sascha Hauer <[email protected]>; Shawn Guo <[email protected]>
Subject: Re: [PATCH] pinctrl: imx: off by one in imx_pinconf_group_dbg_show()

Quoted 1 line · Linus Walleij

On Thu, Jul 19, 2018 at 10:17 AM Dan Carpenter

Quoted 9 lines · <[email protected]> wrote:
Quoted 8 lines

The > should really be >= here. It's harmless because pinctrl_generic_get_group() will return a NULL if group is invalid.

Fixes ae75ff814538 ("pinctrl: pinctrl-imx: add imx pinctrl core

driver")

Quoted 6 lines
Quoted 1 line

Patch applied.

I see that you applied the imx_pinconf_group_dbg_show patch, but not the one specific to imx1 earlier in this thread. These are orthogonal and so both should be applied.

Quoted 4 lines

Right.

BTW just let you know, unlike that patch, this one is just a simple improvement and don't have to go to stable tree.

To clearify: the imx1 change (ie. the one currently missed) is the critical one as it fixes an out-of-bounds access. imx_pinconf_group_dbg_show was harmless, the only change is that with it applied there is one "\n" less in the output.

Best regards
Uwe

Signature · 6 lines
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html