All of lore.kernel.org
 help / color / mirror / Atom feed
* bug report: 9p: 9P2010.L handshake: Add mount option
@ 2010-03-06 12:22 Dan Carpenter
  0 siblings, 0 replies; only message in thread
From: Dan Carpenter @ 2010-03-06 12:22 UTC (permalink / raw)
  To: sripathik; +Cc: netdev

+static unsigned char get_protocol_version(const substring_t *name)
+{
+       unsigned char version = -EINVAL;

Assigning a negative value to an unsigned char is problematic.  (If it's 
an unsigned int or long that's different).

I have included a test program to illustrate.

regards,
dan carpenter

#include <stdio.h>

unsigned char n22(void) { return -22; }

int main()
{
	int ret = n22();

	if (ret == -22)
		printf("true\n");
	else 
		printf("false\n");
}


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2010-03-06 12:23 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-03-06 12:22 bug report: 9p: 9P2010.L handshake: Add mount option Dan Carpenter

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.