[PATCH v2] pinctrl: zynqmp: Ensure function names are NUL terminated

Peter Korsgaard peter at korsgaard.com
Wed Nov 18 08:49:18 PST 2026


>>>>> "Sai" == Sai Krishna Potthuri <sai.krishna.potthuri at amd.com> writes:

 > PM_QID_PINCTRL_GET_FUNCTION_NAME returns the function name in a fixed
 > 16-byte field and does not guarantee NUL termination. A 16-character
 > name fills the entire field.
 > The driver copies this field into a 16-byte buffer and subsequently
 > uses it as a C string. For a non-NUL-terminated name, string operations
 > can read past the end of the buffer into the adjacent groups pointer.

 > Reserve an extra byte for the NUL terminator and explicitly terminate
 > the copied function name.

 > Signed-off-by: Sai Krishna Potthuri <sai.krishna.potthuri at amd.com>
 > ---
 > changes in v2:
 > - Replace macro/constants with sizeof()(comment from David Laight)

Reviewed-by: Peter Korsgaard <peter at korsgaard.com>

-- 
Bye, Peter Korsgaard



More information about the linux-arm-kernel mailing list