1

Linux kernel system call returns -1 instead of {-1, -256}

view story
linux-howto

http://stackoverflow.com – I'm a kernel newbie and am facing a weird issue. I have written a proof-of-concept calculator syscall and while it works fine for most computations, it is returning -1 when the SUBTRACTION result is between -1 to -256. If someone can throw some light on what could be happening, would appreciate it. Below is the syscall code. SYSCALL_DEFINE3(calc, int, a, int, b , char, op) { int res_int; switch(op) { case '+': res_int = a + b; break; case '-': res_int = a - b; break; case '*': res_int = a * b; break; case '/': res_int = (a*1000) (HowTos)