]> git.ipfire.org Git - people/ms/u-boot.git/commit
cmd: nvedit: env_get_f must check for env_get_char error codes
authorSimon Goldschmidt <sgoldschmidt@de.pepperl-fuchs.com>
Wed, 31 Jan 2018 06:56:48 +0000 (07:56 +0100)
committerTom Rini <trini@konsulko.com>
Wed, 31 Jan 2018 23:45:10 +0000 (18:45 -0500)
commit87c7fb396a59d3e2be434cc956462ba46451193b
treeb4b6f06e614e702c6283b2e57d4c7ea9128086e5
parent48f58a59737739b0f96ceba9f7873178c6d917bf
cmd: nvedit: env_get_f must check for env_get_char error codes

env_get_f calls env_get_char to load single characters from the
environment. However, the return value of env_get_char was not
checked for errors. Now if the env driver does not support the
.get_char call, env_get_f did not notice this and looped over the
whole size of the environment, calling env_get_char over 8000
times with the default settings, just to return an error in the
end.

Fix this by checking if env_get_char returns < 0.

Signed-off-by: Simon Goldschmidt <sgoldschmidt@de.pepperl-fuchs.com>
Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com>
cmd/nvedit.c