Re: [PATCH v16 2/3] virt: Add TDX guest driver

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Oct 30, 2022 at 07:53:19AM +0100, Greg Kroah-Hartman wrote:
> On Sat, Oct 29, 2022 at 04:17:39PM -0700, Sathyanarayanan Kuppuswamy wrote:
> > Hi Greg
> > 
> > On 10/27/22 11:25 PM, Greg Kroah-Hartman wrote:
> > > On Thu, Oct 27, 2022 at 05:28:19PM -0700, Kuppuswamy Sathyanarayanan wrote:
> > 
> > >> +
> > >> +static long tdx_guest_ioctl(struct file *file, unsigned int cmd,
> > >> +			    unsigned long arg)
> > >> +{
> > >> +	switch (cmd) {
> > >> +	case TDX_CMD_GET_REPORT:
> > >> +		return tdx_get_report((void __user *)arg);
> > > 
> > > You know the type of this pointer here, why not cast it instead of
> > > having to cast it from void * again?
> > 
> > The only place we use arg pointer is in copy_from_user() function,
> > which expects void __user * pointer. So why cast it as struct
> > tdx_report_req * here?
> 
> Because then your function will show the true type and you don't have to
> cast it again.
> 

If we are taking this route, isn't better to move the copy_from_user
call to tdx_guest_ioctl and pass the resulting struct tdx_report_req
pointer to tdx_get_report?




[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux