]> git.dujemihanovic.xyz Git - u-boot.git/commit
part: Add check for NULL dev_part_str
authorSean Anderson <seanga2@gmail.com>
Sat, 15 May 2021 18:13:54 +0000 (14:13 -0400)
committerTom Rini <trini@konsulko.com>
Wed, 26 May 2021 21:26:07 +0000 (17:26 -0400)
commit26de4296cc20bb45eb40560b4a4a98fa90a16a28
treede1445c07026f8560505516b883685397fbbcb34
parent1e7879045f6c20f68ce2c6fcce7ec187e8844b51
part: Add check for NULL dev_part_str

Some callers (e.g. cmd/fs.c) of fs_set_blk_dev may use a NULL dev_part_str.
While blk_get_device_part_str handles this fine,
part_get_info_by_dev_and_name does not. This fixes commands crashing when
implicitly using bootdevice.

The unit test has also been updated to set bootdevice to a known value and
to restore it after we are done.

Fixes: 7194527b6a ("cmd: fs: Use part_get_info_by_dev_and_name_or_num to parse partitions")
Reported-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
disk/part.c
test/dm/part.c