Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp230264imm; Tue, 16 Oct 2018 22:07:59 -0700 (PDT) X-Google-Smtp-Source: ACcGV63J4D1GE0xwjMWs4kUnQpxhMVJ7DTYypRWvV8PpKj318vuezgihUw9PQ9t0lMMDspWCk1U1 X-Received: by 2002:a62:ea03:: with SMTP id t3-v6mr25972813pfh.228.1539752879176; Tue, 16 Oct 2018 22:07:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539752879; cv=none; d=google.com; s=arc-20160816; b=UnFsdb1i96cc7fmX89ErRQr4oYlyNuy4miGQpieSpydvnCOjlL5B4PsPOmjj3hKI4c 0O9ZwXqMD5bZpVLKfu1L4wPeDBqUIX7zFMC3aluZObWhOS6LwmWdMgHBcAtYoMEEAv8b +MdGlFC8PQpSuVCbs1HBRUNG3z+K+vOmvfKu0HWdChslTvQ9LIAEabbzdCGGJzgdBSrO bfMXlc4UwiVjK547ufu6xyoqIctjmD1RgJZoHkuif/5Gqb7nKqJaX5SFFmUq75loMIyK CeKre+2tvk2JaMI1dNjIbkUcR2e9J2hhy8SqG48pGIH2JkN+DdN6RGj4hRICzH6L7Lds KUxg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=z+fc301vf297h2nYamB8v10WONnp0WlOh7scWGUyTRc=; b=hOPCqyrWlTbKeMRHUnhMhNFFhF9qxdF0pyDPkZtIRJNzdyM+pSAFswX6xi3Po+reaM +wVf7tTBJnTIIKC4r9Oc4o6QZqF59vAYM+ZXLkssEM3SV6UZzzO+4ZZiqPeg5/dEHj+V WWmrkiM7r4tYw7DUxlSI4EO8Fs/cuR8h/fvQ0IT5UDD9aJYAs+cTSBkO2eVqrCgwp3xr mVVrmMuYkPu8I5DuHfnBFsZclVKLJkToSF2Kh/qYI1aNMBxNlsE6OkNbGz4xqFhpBUnF cZCKwA9dyDSdoiK2Rakfgwqcf3Voo0F8+QSoz0IbH0t0ZjMMjaIGnx7O3eGtFZMkQIqp Xo+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=G8daB+WN; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j13-v6si15848366pfn.288.2018.10.16.22.07.42; Tue, 16 Oct 2018 22:07:59 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=G8daB+WN; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727123AbeJQNA6 (ORCPT + 99 others); Wed, 17 Oct 2018 09:00:58 -0400 Received: from mail.kernel.org ([198.145.29.99]:59648 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726210AbeJQNA6 (ORCPT ); Wed, 17 Oct 2018 09:00:58 -0400 Received: from localhost (ip-213-127-77-176.ip.prioritytelecom.net [213.127.77.176]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 29ADD214C4; Wed, 17 Oct 2018 05:07:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1539752827; bh=SuhloOmjwJ4wOWtmIje6UPGKlZmRvcqmgwSjIyaT1PM=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=G8daB+WNP+QBstbinZZH3i2dbau1pAyba/2l3/6Vip7xsKzooPOb/vNdH2x2mFvSO PqAEQ4XMqCh2+D37Vv3khIp4JJxsL//yjCfYIsXKlVzf0P0V9hr7j3emMafBlG2TEt lbq7v3wmiGZI5G8vwhLLgFlygk5q8kbjpbQIOPaU= Date: Wed, 17 Oct 2018 07:07:05 +0200 From: Greg KH To: kys@microsoft.com Cc: linux-kernel@vger.kernel.org, devel@linuxdriverproject.org, olaf@aepfle.de, apw@canonical.com, jasowang@redhat.com, sthemmin@microsoft.com, Michael.H.Kelley@microsoft.com, vkuznets@redhat.com, Haiyang Zhang , Stable@vger.kernel.org Subject: Re: [PATCH 3/5] Drivers: hv: kvp: Fix the recent regression caused by incorrect clean-up Message-ID: <20181017050705.GE22447@kroah.com> References: <20181017031241.669-1-kys@linuxonhyperv.com> <20181017031406.773-1-kys@linuxonhyperv.com> <20181017031406.773-3-kys@linuxonhyperv.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20181017031406.773-3-kys@linuxonhyperv.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Oct 17, 2018 at 03:14:04AM +0000, kys@linuxonhyperv.com wrote: > From: Dexuan Cui > > In kvp_send_key(), we do need call process_ib_ipinfo() if > message->kvp_hdr.operation is KVP_OP_GET_IP_INFO, because it turns out > the userland hv_kvp_daemon needs the info of operation, adapter_id and > addr_family. With the incorrect fc62c3b1977d, the host can't get the > VM's IP via KVP. > > And, fc62c3b1977d added a "break;", but actually forgot to initialize > the key_size/value in the case of KVP_OP_SET, so the default key_size of > 0 is passed to the kvp daemon, and the pool files > /var/lib/hyperv/.kvp_pool_* can't be updated. > > This patch effectively rolls back the previous fc62c3b1977d, and > correctly fixes the "this statement may fall through" warnings. > > This patch is tested on WS 2012 R2 and 2016. > > Fixes: fc62c3b1977d ("Drivers: hv: kvp: Fix two "this statement may fall through" warnings") > Signed-off-by: Dexuan Cui > Cc: K. Y. Srinivasan > Cc: Haiyang Zhang > Cc: Stephen Hemminger > Cc: > Signed-off-by: K. Y. Srinivasan > --- > drivers/hv/hv_kvp.c | 26 ++++++++++++++++++++++---- > 1 file changed, 22 insertions(+), 4 deletions(-) > > diff --git a/drivers/hv/hv_kvp.c b/drivers/hv/hv_kvp.c > index a7513a8a8e37..9fbb15c62c6c 100644 > --- a/drivers/hv/hv_kvp.c > +++ b/drivers/hv/hv_kvp.c > @@ -353,6 +353,9 @@ 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; > > + __attribute__ ((fallthrough)); The comment should be sufficient for this, right? I haven't seen many uses of this attribute before, how common is it? > + > + case KVP_OP_GET_IP_INFO: > utf16s_to_utf8s((wchar_t *)in->kvp_ip_val.adapter_id, > MAX_ADAPTER_ID_SIZE, > UTF16_LITTLE_ENDIAN, > @@ -405,7 +408,11 @@ kvp_send_key(struct work_struct *dummy) > process_ib_ipinfo(in_msg, message, KVP_OP_SET_IP_INFO); > break; > case KVP_OP_GET_IP_INFO: > - /* We only need to pass on message->kvp_hdr.operation. */ > + /* > + * We only need to pass on the info of operation, adapter_id > + * and addr_family to the userland kvp daemon. > + */ > + process_ib_ipinfo(in_msg, message, KVP_OP_GET_IP_INFO); > break; > case KVP_OP_SET: > switch (in_msg->body.kvp_set.data.value_type) { > @@ -446,9 +453,9 @@ kvp_send_key(struct work_struct *dummy) > > } > > - break; > - > - case KVP_OP_GET: > + /* > + * The key is always a string - utf16 encoding. > + */ > message->body.kvp_set.data.key_size = > utf16s_to_utf8s( > (wchar_t *)in_msg->body.kvp_set.data.key, > @@ -456,6 +463,17 @@ kvp_send_key(struct work_struct *dummy) > UTF16_LITTLE_ENDIAN, > message->body.kvp_set.data.key, > HV_KVP_EXCHANGE_MAX_KEY_SIZE - 1) + 1; > + > + break; > + > + case KVP_OP_GET: > + message->body.kvp_get.data.key_size = > + utf16s_to_utf8s( > + (wchar_t *)in_msg->body.kvp_get.data.key, > + in_msg->body.kvp_get.data.key_size, > + UTF16_LITTLE_ENDIAN, > + message->body.kvp_get.data.key, > + HV_KVP_EXCHANGE_MAX_KEY_SIZE - 1) + 1; Worst indentation ever :( Yeah, I know it follows the others above it, but you should reconsider it in the future... thanks, greg k-h