OSDN Git Service

of: unittest: initialize args before calling of_*parse_*()
authorFrank Rowand <frank.rowand@sony.com>
Fri, 5 Oct 2018 03:40:21 +0000 (20:40 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 1 Dec 2019 08:17:30 +0000 (09:17 +0100)
commit367e64ce11fc59fc51b41a8f0f2ba4b5daa23a17
treee31e277c79af38c062a71de4900ad766873e4d02
parente4547e02854776bd8270a7493a5e9f40e77c7ce4
of: unittest: initialize args before calling of_*parse_*()

[ Upstream commit eeb07c573ec307c53fe2f6ac6d8d11c261f64006 ]

Callers of of_irq_parse_one() blindly use the pointer args.np
without checking whether of_irq_parse_one() had an error and
thus did not set the value of args.np.  Initialize args to
zero so that using the format "%pOF" to show the value of
args.np will show "(null)" when of_irq_parse_one() has an
error.  This prevents the dereference of a random value.

Make the same fix for callers of of_parse_phandle_with_args()
and of_parse_phandle_with_args_map().

Reported-by: Guenter Roeck <linux@roeck-us.net>
Tested-by: Alan Tull <atull@kernel.org>
Signed-off-by: Frank Rowand <frank.rowand@sony.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/of/unittest.c