Skip to contentSkip to conversation

bug report: 9p: 9P2010.L handshake: Add mount option

DISCUSSION Dan Carpenter 1 participant 1 message Mar 6, 2010

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

+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");
}