lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20241017220740.30370-1-everestkc@everestkc.com.np>
Date: Thu, 17 Oct 2024 16:07:24 -0600
From: "Everest K.C." <everestkc@...restkc.com.np>
To: dpenkler@...il.com,
	gregkh@...uxfoundation.org,
	nathan@...nel.org
Cc: "Everest K.C." <everestkc@...restkc.com.np>,
	skhan@...uxfoundation.org,
	linux-staging@...ts.linux.dev,
	linux-kernel@...r.kernel.org
Subject: [PATCH] staging: gpib: Change return type and error code of fmh_gpib_get_dma_residue()

fmh_gpib_get_dma_residue() returns unsigned int with -1 as error code.
This error cannot be caught.
Fix this by changing the return type of the function to int and
returning the error code, that was captured. Also, change the data
type of variable residue to int in the function fmh_gpib_dma_read().

Fixes: 8e4841a0888c ("staging: gpib: Add Frank Mori Hess FPGA PCI GPIB driver")
Reported-by: Shuah Khan <skhan@...uxfoundation.org>
Signed-off-by: Everest K.C. <everestkc@...restkc.com.np>
---
 drivers/staging/gpib/fmh_gpib/fmh_gpib.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/gpib/fmh_gpib/fmh_gpib.c b/drivers/staging/gpib/fmh_gpib/fmh_gpib.c
index 0e27b3ef1a1d..802043ffe684 100644
--- a/drivers/staging/gpib/fmh_gpib/fmh_gpib.c
+++ b/drivers/staging/gpib/fmh_gpib/fmh_gpib.c
@@ -547,7 +547,7 @@ static int fmh_gpib_accel_write(gpib_board_t *board, uint8_t *buffer,
 	return 0;
 }
 
-static unsigned int fmh_gpib_get_dma_residue(struct dma_chan *chan, dma_cookie_t cookie)
+static int fmh_gpib_get_dma_residue(struct dma_chan *chan, dma_cookie_t cookie)
 {
 	struct dma_tx_state state;
 	int result;
@@ -555,7 +555,7 @@ static unsigned int fmh_gpib_get_dma_residue(struct dma_chan *chan, dma_cookie_t
 	result = dmaengine_pause(chan);
 	if (result < 0)	{
 		pr_err("fmh_gpib_gpib: dma pause failed?\n");
-		return -1;
+		return result;
 	}
 	dmaengine_tx_status(chan, cookie, &state);
 	// dma330 hardware doesn't support resume, so dont call this
@@ -717,7 +717,7 @@ static int fmh_gpib_dma_read(gpib_board_t *board, uint8_t *buffer,
 	struct nec7210_priv *nec_priv = &e_priv->nec7210_priv;
 	int retval = 0;
 	unsigned long flags;
-	unsigned int residue;
+	int residue;
 	int wait_retval;
 	dma_addr_t bus_address;
 	struct dma_async_tx_descriptor *tx_desc;
-- 
2.43.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ