linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Fabian Frederick <fabf@skynet.be>
To: Jan Kara <jack@suse.cz>
Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org,
	fabf@skynet.be
Subject: [PATCH 1/1 linux-next] udf: return inappropriate ioctl instead of argument error
Date: Thu, 19 Jan 2017 21:41:37 +0100	[thread overview]
Message-ID: <20170119204137.31158-1-fabf@skynet.be> (raw)

Currently, lsattr for instance in udf directory gives
"udf: Invalid argument While reading flags on ..."

This patch removes argument testing and returns -ENOIOCTLCMD
when command is unknown to have more accurate message like this:
"Inappropriate ioctl for device While reading flags on ..."
If arg is NULL, we return specific operation error anyway.

Signed-off-by: Fabian Frederick <fabf@skynet.be>
---
 fs/udf/file.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/fs/udf/file.c b/fs/udf/file.c
index dbcb3a4a..964620b 100644
--- a/fs/udf/file.c
+++ b/fs/udf/file.c
@@ -184,12 +184,6 @@ long udf_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
 		goto out;
 	}
 
-	if (!arg) {
-		udf_debug("invalid argument to udf_ioctl\n");
-		result = -EINVAL;
-		goto out;
-	}
-
 	switch (cmd) {
 	case UDF_GETVOLIDENT:
 		if (copy_to_user((char __user *)arg,
@@ -220,6 +214,8 @@ long udf_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
 				      UDF_I(inode)->i_ext.i_data,
 				      UDF_I(inode)->i_lenEAttr) ? -EFAULT : 0;
 		goto out;
+	default:
+		return -ENOIOCTLCMD;
 	}
 
 out:
-- 
2.9.3


             reply	other threads:[~2017-01-19 20:42 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-19 20:41 Fabian Frederick [this message]
2017-01-20 10:19 ` [PATCH 1/1 linux-next] udf: return inappropriate ioctl instead of argument error Jan Kara

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170119204137.31158-1-fabf@skynet.be \
    --to=fabf@skynet.be \
    --cc=jack@suse.cz \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).