Skip to content

Commit

Permalink
9p: saving negative to unsigned char
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Eric Van Hensbergen <[email protected]>
  • Loading branch information
error27 authored and ericvh committed Apr 5, 2010
1 parent 85a770a commit 3dc9fef
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions net/9p/client.c
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down

0 comments on commit 3dc9fef

Please sign in to comment.