media: ccs: Clean up parsed CCS static data on parse failure
Subsystems (2)
Sakari Ailus
maintainerPATCH 1/1 media: ccs: Clean up parsed CCS static data on parse failure
ccs_data_parse() releases the allocated in-memory data structure when the parser fails, but it does not clean up parsed metadata that is there to help access the actual data. Do that, in order to return the data structure in a sane state.
--- drivers/media/i2c/ccs/ccs-data.c | 1 + 1 file changed, 1 insertion(+)
drivers/media/i2c/ccs/ccs-data.c +1 -0
@@ -974,6 +974,7 @@ int ccs_data_parse(struct ccs_data_container *ccsdata, const void *data, out_free:kvfree (bin.base); + memset(ccsdata, 0, sizeof(*ccsdata);return rval; }
Signature · 1 line
2.39.5
kernel test robot
build botkernel test robot noticed the following build errors:
Hi Sakari,
kernel test robot noticed the following build errors:
[auto build test ERROR on linuxtv-media-pending/master]
[also build test ERROR on linus/master media-tree/master sailus-media-tree/streams sailus-media-tree/master v6.13-rc1 next-20241128] [If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Sakari-Ailus/media-ccs-Clean-up-parsed-CCS-static-data-on-parse-failure/20241203-183006 base: https://git.linuxtv.org/media-ci/media-pending.git master patch link: https://lore.kernel.org/r/20241203102737.851076-1-sakari.ailus%40linux.intel.com patch subject: [PATCH 1/1] media: ccs: Clean up parsed CCS static data on parse failure config: arc-randconfig-002-20241203 (https://download.01.org/0day-ci/archive/20241203/[email protected]/config) compiler: arceb-elf-gcc (GCC) 13.2.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241203/[email protected]/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All error/warnings (new ones prefixed by >>):
drivers/media/i2c/ccs/ccs-data.c: In function 'ccs_data_parse':
>> drivers/media/i2c/ccs/ccs-data.c:977:44: error: expected ')' before ';' token
977 | memset(ccsdata, 0, sizeof(*ccsdata);
| ~ ^
| )
>> drivers/media/i2c/ccs/ccs-data.c:979:21: error: expected ';' before '}' token
979 | return rval;
| ^
| ;
980 | }
| ~
>> drivers/media/i2c/ccs/ccs-data.c:980:1: warning: control reaches end of non-void function [-Wreturn-type]
980 | }
| ^vim +977 drivers/media/i2c/ccs/ccs-data.c
933
934 /**
935 * ccs_data_parse - Parse a CCS static data file into a usable in-memory
936 * data structure
937 * @ccsdata: CCS static data in-memory data structure
938 * @data: CCS static data binary
939 * @len: Length of @data
940 * @dev: Device the data is related to (used for printing debug messages)
941 * @verbose: Whether to be verbose or not
942 */
943 int ccs_data_parse(struct ccs_data_container *ccsdata, const void *data,
944 size_t len, struct device *dev, bool verbose)
945 {
946 struct bin_container bin = { 0 };
947 int rval;
948
949 rval = __ccs_data_parse(&bin, ccsdata, data, len, dev, verbose);
950 if (rval)
951 return rval;
952
953 rval = bin_backing_alloc(&bin);
954 if (rval)
955 return rval;
956
957 rval = __ccs_data_parse(&bin, ccsdata, data, len, dev, false);
958 if (rval)
959 goto out_free;
960
961 if (verbose && ccsdata->version)
962 print_ccs_data_version(dev, ccsdata->version);
963
964 if (bin.now != bin.end) {
965 rval = -EPROTO;
966 dev_dbg(dev, "parsing mismatch; base %p; now %p; end %p\n",
967 bin.base, bin.now, bin.end);
968 goto out_free;
969 }
970
971 ccsdata->backing = bin.base;
972
973 return 0;
974
975 out_free:
976 kvfree(bin.base);
> 977 memset(ccsdata, 0, sizeof(*ccsdata); 978 > 979 return rval; > 980 }
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki