[PATCH 1/2] soc: aspeed: Add LPC mailbox support

ChiaWei Wang chiawei_wang at aspeedtech.com
Tue Aug 17 12:37:13 AEST 2021


Hi Dan,

> -----Original Message-----
> From: Dan Carpenter <dan.carpenter at oracle.com>
> Sent: Monday, August 16, 2021 5:41 PM
> 
> Hi Chia-Wei,
> 
> url:
> https://github.com/0day-ci/linux/commits/Chia-Wei-Wang/aspeed-Add-LPC-m
> ailbox-support/20210813-134908
> base:   https://git.kernel.org/pub/scm/linux/kernel/git/joel/aspeed.git
> for-next
> config: openrisc-randconfig-m031-20210816 (attached as .config)
> compiler: or1k-linux-gcc (GCC) 11.2.0
> 
> If you fix the issue, kindly add following tag as appropriate
> Reported-by: kernel test robot <lkp at intel.com>
> Reported-by: Dan Carpenter <dan.carpenter at oracle.com>
> 
> smatch warnings:
> drivers/soc/aspeed/aspeed-lpc-mbox.c:230 aspeed_mbox_ioctl() warn: maybe
> return -EFAULT instead of the bytes remaining?
> 
> vim +230 drivers/soc/aspeed/aspeed-lpc-mbox.c
> 
> 72c5a69dc779f5 Chia-Wei Wang 2021-08-13  214  static long
> aspeed_mbox_ioctl(struct file *file, unsigned int cmd,
> 72c5a69dc779f5 Chia-Wei Wang 2021-08-13  215
> unsigned long param)
> 72c5a69dc779f5 Chia-Wei Wang 2021-08-13  216  {
> 72c5a69dc779f5 Chia-Wei Wang 2021-08-13  217  	struct aspeed_mbox
> *mbox = file_mbox(file);
> 72c5a69dc779f5 Chia-Wei Wang 2021-08-13  218  	const struct
> aspeed_mbox_model *model = mbox->model;
> 72c5a69dc779f5 Chia-Wei Wang 2021-08-13  219  	struct
> aspeed_mbox_ioctl_data data;
> 72c5a69dc779f5 Chia-Wei Wang 2021-08-13  220  	long ret;
> 72c5a69dc779f5 Chia-Wei Wang 2021-08-13  221
> 72c5a69dc779f5 Chia-Wei Wang 2021-08-13  222  	switch (cmd) {
> 72c5a69dc779f5 Chia-Wei Wang 2021-08-13  223  	case
> ASPEED_MBOX_IOCTL_GET_SIZE:
> 72c5a69dc779f5 Chia-Wei Wang 2021-08-13  224  		data.data =
> model->dr_num;
> 72c5a69dc779f5 Chia-Wei Wang 2021-08-13  225  		ret =
> copy_to_user((void __user *)param, &data, sizeof(data));
> 
> This should be:
> 
> 	if (copy_to_user((void __user *)param, &data, sizeof(data)))
> 		return -EFAULT;

Will be fixed in v2 patch. Thanks for the review.

Regards,
Chiawei

> 
> 72c5a69dc779f5 Chia-Wei Wang 2021-08-13  226  		break;
> 72c5a69dc779f5 Chia-Wei Wang 2021-08-13  227  	default:
> 72c5a69dc779f5 Chia-Wei Wang 2021-08-13  228  		ret = -ENOTTY;
> 72c5a69dc779f5 Chia-Wei Wang 2021-08-13  229  	}
> 72c5a69dc779f5 Chia-Wei Wang 2021-08-13 @230  	return ret;
> 72c5a69dc779f5 Chia-Wei Wang 2021-08-13  231  }
> 
> ---
> 0-DAY CI Kernel Test Service, Intel Corporation
> https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org



More information about the Linux-aspeed mailing list