[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20240402115157.672915-1-shum.sdl@nppct.ru>
Date: Tue, 2 Apr 2024 14:51:57 +0300
From: Andrey Shumilin <shum.sdl@...ct.ru>
To: Juergen Gross <jgross@...e.com>
Cc: Andrey Shumilin <shum.sdl@...ct.ru>,
Stefano Stabellini <sstabellini@...nel.org>,
Oleksandr Tyshchenko <oleksandr_tyshchenko@...m.com>,
linux-kernel@...r.kernel.org,
lvc-project@...uxtesting.org,
khoroshilov@...ras.ru,
ykarpov@...ras.ru,
vmerzlyakov@...ras.ru,
vefanov@...ras.ru
Subject: [PATCH 4/4] gntdev: Unchecked finction result
The dma_coerce_mask_and_coherent function may refuse
to apply a mask due to incorrectly passed parameters.
But since this function returns the error -EIO, this
is an abnormal situation and the error must be written to the log.
Do not return an error from the function.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
Signed-off-by: Andrey Shumilin <shum.sdl@...ct.ru>
---
drivers/xen/gntdev.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/xen/gntdev.c b/drivers/xen/gntdev.c
index 61faea1f0663..8a448dbbca86 100644
--- a/drivers/xen/gntdev.c
+++ b/drivers/xen/gntdev.c
@@ -597,7 +597,8 @@ static int gntdev_open(struct inode *inode, struct file *flip)
flip->private_data = priv;
#ifdef CONFIG_XEN_GRANT_DMA_ALLOC
priv->dma_dev = gntdev_miscdev.this_device;
- dma_coerce_mask_and_coherent(priv->dma_dev, DMA_BIT_MASK(64));
+ if (dma_coerce_mask_and_coherent(priv->dma_dev, DMA_BIT_MASK(64)) == -EIO)
+ pr_err("The mask was applied unsuccessfully");
#endif
pr_debug("priv %p\n", priv);
--
2.30.2
Powered by blists - more mailing lists