Commit fc62c3b1 authored by Dexuan Cui's avatar Dexuan Cui Committed by Greg Kroah-Hartman

Drivers: hv: kvp: Fix two "this statement may fall through" warnings

We don't need to call process_ib_ipinfo() if message->kvp_hdr.operation is
KVP_OP_GET_IP_INFO in kvp_send_key(), because here we just need to pass on
the op code from the host to the userspace; when the userspace returns
the info requested by the host, we pass the info on to the host in
kvp_respond_to_host() -> process_ob_ipinfo(). BTW, the current buggy code
actually doesn't cause any harm, because only message->kvp_hdr.operation
is used by the userspace, in the case of KVP_OP_GET_IP_INFO.

The patch also adds a missing "break;" in kvp_send_key(). BTW, the current
buggy code actually doesn't cause any harm, because in the case of
KVP_OP_SET, the unexpected fall-through corrupts
message->body.kvp_set.data.key_size, but that is not really used: see
the definition of struct hv_kvp_exchg_msg_value.
Signed-off-by: default avatarDexuan Cui <decui@microsoft.com>
Cc: K. Y. Srinivasan <kys@microsoft.com>
Cc: Haiyang Zhang <haiyangz@microsoft.com>
Cc: Stephen Hemminger <sthemmin@microsoft.com>
Cc: <Stable@vger.kernel.org>
Signed-off-by: default avatarK. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent d544c22d
...@@ -353,7 +353,6 @@ static void process_ib_ipinfo(void *in_msg, void *out_msg, int op) ...@@ -353,7 +353,6 @@ static void process_ib_ipinfo(void *in_msg, void *out_msg, int op)
out->body.kvp_ip_val.dhcp_enabled = in->kvp_ip_val.dhcp_enabled; out->body.kvp_ip_val.dhcp_enabled = in->kvp_ip_val.dhcp_enabled;
default:
utf16s_to_utf8s((wchar_t *)in->kvp_ip_val.adapter_id, utf16s_to_utf8s((wchar_t *)in->kvp_ip_val.adapter_id,
MAX_ADAPTER_ID_SIZE, MAX_ADAPTER_ID_SIZE,
UTF16_LITTLE_ENDIAN, UTF16_LITTLE_ENDIAN,
...@@ -406,7 +405,7 @@ kvp_send_key(struct work_struct *dummy) ...@@ -406,7 +405,7 @@ kvp_send_key(struct work_struct *dummy)
process_ib_ipinfo(in_msg, message, KVP_OP_SET_IP_INFO); process_ib_ipinfo(in_msg, message, KVP_OP_SET_IP_INFO);
break; break;
case KVP_OP_GET_IP_INFO: case KVP_OP_GET_IP_INFO:
process_ib_ipinfo(in_msg, message, KVP_OP_GET_IP_INFO); /* We only need to pass on message->kvp_hdr.operation. */
break; break;
case KVP_OP_SET: case KVP_OP_SET:
switch (in_msg->body.kvp_set.data.value_type) { switch (in_msg->body.kvp_set.data.value_type) {
...@@ -446,6 +445,9 @@ kvp_send_key(struct work_struct *dummy) ...@@ -446,6 +445,9 @@ kvp_send_key(struct work_struct *dummy)
break; break;
} }
break;
case KVP_OP_GET: case KVP_OP_GET:
message->body.kvp_set.data.key_size = message->body.kvp_set.data.key_size =
utf16s_to_utf8s( utf16s_to_utf8s(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment