linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] char: mwave: fix return type in ioctl
@ 2022-08-04  7:06 Dan Carpenter
  2022-08-04  8:20 ` Arnd Bergmann
  2022-08-04 18:19 ` Alan
  0 siblings, 2 replies; 5+ messages in thread
From: Dan Carpenter @ 2022-08-04  7:06 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Greg Kroah-Hartman, Andrew Morton, Alan Cox, linux-kernel,
	kernel-janitors

This function is supposed to return zero for success or negative error
code on failure.  Unfortunately the "retval" is declared as unsigned int
and the function returns type long.  That means that on 64 bit systems
it will return positive values on error.

Fixes: 909d145f0dec ("mwave: ioctl BKL pushdown")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
The Fixes tag is sort of debatable.  "retval" should have always been
declared as an int.  But the BKL change is when the return type for
the ioctl changed from int to long, so it's when the bug started to
affect user space.

 drivers/char/mwave/mwavedd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/char/mwave/mwavedd.c b/drivers/char/mwave/mwavedd.c
index 11272d605ecd..5813517faf4d 100644
--- a/drivers/char/mwave/mwavedd.c
+++ b/drivers/char/mwave/mwavedd.c
@@ -123,7 +123,7 @@ static int mwave_close(struct inode *inode, struct file *file)
 static long mwave_ioctl(struct file *file, unsigned int iocmd,
 							unsigned long ioarg)
 {
-	unsigned int retval = 0;
+	int retval = 0;
 	pMWAVE_DEVICE_DATA pDrvData = &mwave_s_mdd;
 	void __user *arg = (void __user *)ioarg;
 
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-08-10  9:19 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-04  7:06 [PATCH] char: mwave: fix return type in ioctl Dan Carpenter
2022-08-04  8:20 ` Arnd Bergmann
2022-08-04  8:35   ` Dan Carpenter
2022-08-04 18:19 ` Alan
2022-08-10  9:18   ` [PATCH] get_maintainer: Add Alan to .get_maintainer.ignore Dan Carpenter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).