Re: [PATCH] auxdisplay: hd44780: Fix potential memory leak in hd44780_remove()

From: kernel test robot
Date: Wed Sep 07 2022 - 05:37:43 EST


Hi Jianglei,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on linus/master]
[also build test WARNING on v6.0-rc4 next-20220906]
[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/Jianglei-Nie/auxdisplay-hd44780-Fix-potential-memory-leak-in-hd44780_remove/20220907-151008
base: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 0066f1b0e27556381402db3ff31f85d2a2265858
config: m68k-allyesconfig (https://download.01.org/0day-ci/archive/20220907/202209071724.9KXWPPZ7-lkp@xxxxxxxxx/config)
compiler: m68k-linux-gcc (GCC) 12.1.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/intel-lab-lkp/linux/commit/bef273823cd1f11736f4e0ce7fcf5d4ac2e1b972
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Jianglei-Nie/auxdisplay-hd44780-Fix-potential-memory-leak-in-hd44780_remove/20220907-151008
git checkout bef273823cd1f11736f4e0ce7fcf5d4ac2e1b972
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=m68k SHELL=/bin/bash drivers/

If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@xxxxxxxxx>

All warnings (new ones prefixed by >>):

drivers/auxdisplay/hd44780.c: In function 'hd44780_remove':
>> drivers/auxdisplay/hd44780.c:327:27: warning: dereferencing 'void *' pointer
327 | kfree(lcd->drvdata->hd44780);
| ^~
drivers/auxdisplay/hd44780.c:327:27: error: request for member 'hd44780' in something not a structure or union


vim +327 drivers/auxdisplay/hd44780.c

321
322 static int hd44780_remove(struct platform_device *pdev)
323 {
324 struct charlcd *lcd = platform_get_drvdata(pdev);
325
326 charlcd_unregister(lcd);
> 327 kfree(lcd->drvdata->hd44780);
328 kfree(lcd->drvdata);
329
330 kfree(lcd);
331 return 0;
332 }
333

--
0-DAY CI Kernel Test Service
https://01.org/lkp