Message ID | 20241203102737.851076-1-sakari.ailus@linux.intel.com (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | [1/1] media: ccs: Clean up parsed CCS static data on parse failure | expand |
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/202412032012.8W7tXCJq-lkp@intel.com/config) compiler: arceb-elf-gcc (GCC) 13.2.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241203/202412032012.8W7tXCJq-lkp@intel.com/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 <lkp@intel.com> | Closes: https://lore.kernel.org/oe-kbuild-all/202412032012.8W7tXCJq-lkp@intel.com/ 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 }
diff --git a/drivers/media/i2c/ccs/ccs-data.c b/drivers/media/i2c/ccs/ccs-data.c index 9d42137f4799..29c4fa70f739 100644 --- a/drivers/media/i2c/ccs/ccs-data.c +++ b/drivers/media/i2c/ccs/ccs-data.c @@ -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; }
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. Reported-by: David Heidelberg <david@ixit.cz> Fixes: a6b396f410b1 ("media: ccs: Add CCS static data parser library") Cc: stable@vger.kernel.org Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> --- drivers/media/i2c/ccs/ccs-data.c | 1 + 1 file changed, 1 insertion(+)