Message ID | 20240620084932.4759-2-sam.van.den.berge@gmail.com |
---|---|
State | Accepted |
Headers | show |
Series | Fix failing A/B UBI volume updates | expand |
sam.van.den.berge@gmail.com wrote on Thu, Jun 20, 2024 at 10:49:32AM +0200: > From: Sam Van Den Berge <sam.van.den.berge@gmail.com> > > Commit "5604c225 handlers: ubivol: Allow specifying MTD device" breaks UBI A/B > volume updates with an atomic swap at the end of the update because 1 strlen > check is missing in ubi_volume_get_info. > > This fixes the following error: > > [ERROR] : SWUPDATE failed [0] ERROR : does not exist > [ERROR] : SWUPDATE failed [0] ERROR : could not found UBI volume root_r > [ERROR] : SWUPDATE failed [0] ERROR : execute postinstall scripts failed > [ERROR] : SWUPDATE failed [1] Installation failed ! > > Signed-off-by: Sam Van Den Berge <sam.van.den.berge@gmail.com> > --- > handlers/ubivol_handler.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/handlers/ubivol_handler.c b/handlers/ubivol_handler.c > index 9db6472e..0ad0321e 100644 > --- a/handlers/ubivol_handler.c > +++ b/handlers/ubivol_handler.c > @@ -506,7 +506,7 @@ static int ubi_volume_get_info(char *device, char *name, int *dev_num, int *vol_ > { > struct ubi_part *ubi_part; > > - if (device) > + if (strlen(device)) device comes from img->device which is part of img so cannot be NULL, looks good to me. (style wise I'd nitpick all these 'if (strlen(device))' checks in this file could be 'if (device[0])' as we don't care about the length, but it doesn't really matter for this kind of sizes) Reviewed-by: Dominique Martinet <dominique.martinet@atmark-techno.com> Thanks!
diff --git a/handlers/ubivol_handler.c b/handlers/ubivol_handler.c index 9db6472e..0ad0321e 100644 --- a/handlers/ubivol_handler.c +++ b/handlers/ubivol_handler.c @@ -506,7 +506,7 @@ static int ubi_volume_get_info(char *device, char *name, int *dev_num, int *vol_ { struct ubi_part *ubi_part; - if (device) + if (strlen(device)) ubi_part = search_volume_local(device, name); else ubi_part = search_volume_global(name);