On Tue, Nov 24, 2020 at 11:01:26AM -0500, min.li...@renesas.com wrote: > From: Min Li <min.li...@renesas.com> > > Feed kstrtou8 with NULL terminated string. > > Changes since v1: > -Use sscanf to get rid of adhoc string parse.
This is much nicer. Small issue remains... > + u8 ver1[3], ver2[3]; > + int i; > + > + if (sscanf(version1, "%hhu.%hhu.%hhu", > + &ver1[0], &ver1[1], &ver1[2]) < 0) > + return -1; The sscanf function returns the number of scanned items, and so you should check that it returns 3 (three). > + if (sscanf(version2, "%hhu.%hhu.%hhu", > + &ver2[0], &ver2[1], &ver2[2]) < 0) > + return -1; Same here. Thanks, Richard