Re: [pci:ptm-debugfs 1/4] drivers/pci/pcie/ptm.c:275 context_update_write() error: buffer overflow 'buf' 7 <= 7

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

 



Hello,

[...]
> smatch warnings:
> drivers/pci/pcie/ptm.c:275 context_update_write() error: buffer overflow 'buf' 7 <= 7
> 
> vim +/buf +275 drivers/pci/pcie/ptm.c
> 
> 1130deffd29ab2 Manivannan Sadhasivam 2025-05-05  257  static ssize_t context_update_write(struct file *file, const char __user *ubuf,
> 1130deffd29ab2 Manivannan Sadhasivam 2025-05-05  258  			     size_t count, loff_t *ppos)
> 1130deffd29ab2 Manivannan Sadhasivam 2025-05-05  259  {
> 1130deffd29ab2 Manivannan Sadhasivam 2025-05-05  260  	struct pci_ptm_debugfs *ptm_debugfs = file->private_data;
> 1130deffd29ab2 Manivannan Sadhasivam 2025-05-05  261  	char buf[7];
> 1130deffd29ab2 Manivannan Sadhasivam 2025-05-05  262  	int ret;
> 1130deffd29ab2 Manivannan Sadhasivam 2025-05-05  263  	u8 mode;
> 1130deffd29ab2 Manivannan Sadhasivam 2025-05-05  264  
> 1130deffd29ab2 Manivannan Sadhasivam 2025-05-05  265  	if (!ptm_debugfs->ops->context_update_write)
> 1130deffd29ab2 Manivannan Sadhasivam 2025-05-05  266  		return -EOPNOTSUPP;
> 1130deffd29ab2 Manivannan Sadhasivam 2025-05-05  267  
> 1130deffd29ab2 Manivannan Sadhasivam 2025-05-05  268  	if (count < 1 || count > sizeof(buf))
> 
> Should be >= instead of >.

Done.  Fixed directly on the branch, see:

  https://git.kernel.org/pub/scm/linux/kernel/git/pci/pci.git/commit/?h=ptm-debugfs&id=132833405e61463d47d6badff1b8080b09b5808e

Thank you, Dan!

	Krzysztof




[Index of Archives]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux