* [patch] 9p: saving negative to unsigned char
@ 2010-03-30 9:42 Dan Carpenter
0 siblings, 0 replies; only message in thread
From: Dan Carpenter @ 2010-03-30 9:42 UTC (permalink / raw)
To: Eric Van Hensbergen
Cc: David S. Miller, Abhishek Kulkarni, Sripathi Kodi,
Latchesar Ionkov, Venkateswararao Jujjuri, linux-kernel, netdev,
kernel-janitors
Saving -EINVAL as unsigned char truncates the high bits and changes it
into 234 instead of -22. This breaks the test for "if (ret == -EINVAL)"
in parse_opts().
Signed-off-by: Dan Carpenter <error27@gmail.com>
diff --git a/net/9p/client.c b/net/9p/client.c
index e3e5bf4..edf31aa 100644
--- a/net/9p/client.c
+++ b/net/9p/client.c
@@ -71,9 +71,10 @@ inline int p9_is_proto_dotu(struct p9_client *clnt)
EXPORT_SYMBOL(p9_is_proto_dotu);
/* Interpret mount option for protocol version */
-static unsigned char get_protocol_version(const substring_t *name)
+static int get_protocol_version(const substring_t *name)
{
- unsigned char version = -EINVAL;
+ int version = -EINVAL;
+
if (!strncmp("9p2000", name->from, name->to-name->from)) {
version = p9_proto_legacy;
P9_DPRINTK(P9_DEBUG_9P, "Protocol version: Legacy\n");
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2010-03-30 9:42 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-03-30 9:42 [patch] 9p: saving negative to unsigned char 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).