Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ipmi: Fix return value when a message is truncated

The user can ask the message to be returned even if it didn't supply
enough memory for the data, and it will return an error but still
fills in as much data as possible. However, the return value
wasn't being set to an error, it was being overwritten. Create a
second return value for that case.

Signed-off-by: Corey Minyard <cminyard@mvista.com>

+3 -3
+3 -3
drivers/char/ipmi/ipmi_devintf.c
··· 207 207 struct list_head *entry; 208 208 struct ipmi_recv_msg *msg; 209 209 unsigned long flags; 210 - int rv = 0; 210 + int rv = 0, rv2 = 0; 211 211 212 212 /* We claim a mutex because we don't want two 213 213 users getting something from the queue at a time. ··· 250 250 251 251 if (msg->msg.data_len > 0) { 252 252 if (rsp->msg.data_len < msg->msg.data_len) { 253 - rv = -EMSGSIZE; 253 + rv2 = -EMSGSIZE; 254 254 if (trunc) 255 255 msg->msg.data_len = rsp->msg.data_len; 256 256 else ··· 274 274 275 275 mutex_unlock(&priv->recv_mutex); 276 276 ipmi_free_recv_msg(msg); 277 - return 0; 277 + return rv2; 278 278 279 279 recv_putback_on_err: 280 280 /* If we got an error, put the message back onto