Skip to contentSkip to conversation

Fix error handling in HDIO_GETGEO compat wrapper

PATCH New Andreas Schwab 1 participant 1 message Apr 30, 2007 VFS

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix error handling in HDIO_GETGEO compat wrapper

Don't clobber error from sys_ioctl in HDIO_GETGEO compat wrapper.

---
 fs/compat_ioctl.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
fs/compat_ioctl.c +3 -1
@@ -670,8 +670,10 @@ static int hdio_getgeo(unsigned int fd, 
 	if (!err) {
 		err = copy_to_user (ugeo, &geo, 4);
 		err |= __put_user (geo.start, &ugeo->start);
+		if (err)
+			err = -EFAULT;
 	}
-	return err ? -EFAULT : 0;
+	return err;
 }
 
 static int hdio_ioctl_trans(unsigned int fd, unsigned int cmd, unsigned long arg)

Andreas.

Signature · 4 lines
Andreas Schwab, SuSE Labs, [email protected]
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."