Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3189395imu; Mon, 17 Dec 2018 15:08:58 -0800 (PST) X-Google-Smtp-Source: AFSGD/XYiJCUuqx4ShLayA9JVAWuxKP3Qmn1oLAStL9efwlSFEf2mjBxypoxCKQ8QW71ftd8Axec X-Received: by 2002:a62:5716:: with SMTP id l22mr14949729pfb.16.1545088138523; Mon, 17 Dec 2018 15:08:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1545088138; cv=none; d=google.com; s=arc-20160816; b=0scOOjXefARoXUMovHQzEd2AjtqK0d8PGQ8Ui+beIjBYKDqDwO+Dz8kMM5H4JRMqMP aT+ImpRFNoBMHf64LCzA21QrvqihWkAvgGfAXKlByAmFZwKnIdQ5pzq/QMsfQPor/002 kn6I2F8EuByM2s5xJAX1jgrL5nP4pWgkdC8cZp0APJGbCJ5wvOAewEZDebfSXsYd2SNo Z3u6uLj/bc11xgG9h5zofD5S9NbCOpg2aJO0szxJaES4sRWZUK88ujHza6n9JbPiRWOX kzjSbXCeOTzh7FcFehi+CDw5HrKGGIwnK4I+6brSR7spaaBgLwCke52AOSqADmLgidjS WJ0A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=qbdXTd/0EpkT5V540myqgEFTzKaGadElIpBS2jT3Zho=; b=mVK6rMgYqjWU7YIWD4jtc+B+x+aySO+Tj33qc2YtuoaeXGgXBhuNHSzSNfb4K2dCh3 kItW0QwlkN6oPLYGng9DICNwUAC/ap1aQSpSDN2ZmnKUb4TF/9Slmj5REcFFILuadfTn VDhsCU4nQlAQNI0G3xWLIfbPy7g/5Ot2fuwzmo5nuxfY8zYBbIvNqMe4R1IcluIQKV1l K/PnLvBl5De0EmihptbUCf/jviIHhIQ86Ga7kl21S6hiwG+tLlRhlQyt3v2uiOFgIm93 RPECiawtvo1X6IXtO6YfQ4p3Az8uZZ/rifotawmXoTUB+7KNSugKZW7nnt7DJ9FJt23j ID6A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@networkplumber-org.20150623.gappssmtp.com header.s=20150623 header.b=nZ1QnFT4; 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 t2si11420965plz.344.2018.12.17.15.08.43; Mon, 17 Dec 2018 15:08:58 -0800 (PST) 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=@networkplumber-org.20150623.gappssmtp.com header.s=20150623 header.b=nZ1QnFT4; 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 S2388679AbeLQSRM (ORCPT + 99 others); Mon, 17 Dec 2018 13:17:12 -0500 Received: from mail-pl1-f196.google.com ([209.85.214.196]:40303 "EHLO mail-pl1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727597AbeLQSRM (ORCPT ); Mon, 17 Dec 2018 13:17:12 -0500 Received: by mail-pl1-f196.google.com with SMTP id u18so6508724plq.7 for ; Mon, 17 Dec 2018 10:17:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=qbdXTd/0EpkT5V540myqgEFTzKaGadElIpBS2jT3Zho=; b=nZ1QnFT4RXoniyD9K9YkKqu3Nq+9E/FNHGFITs7dsD0eeGqiRDWQhspoCJgiTNLZQc Kb60sle3uahgXyNqTBs1AwrF/3GnLZlxa3+eWwYR+ugdXApVLc1hTFUsnJ1GusSvyYzw 9Pd8vstFM7aOF0hIdbRvbIcmZpfTx1Zr9PncSL2Tx6ipDpFVsxRKP8OuDo6eaTFWEUmq BAWcUps6/LL2YX/vFONtOTKjc7JA3bn1CN4A88FtY0+j4AVq2Baz4vey/XwomqQ+6+Kb Q/EB12V+1kn3dikXngamLOz5CtsCUIiNPch2DzkED88mFZLKKK2QTBLUjZNzXRXvThUO +6ag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=qbdXTd/0EpkT5V540myqgEFTzKaGadElIpBS2jT3Zho=; b=P9s/4TXT7Mpf76TULSkdDbxIoUsSHApza3UihNDNvu4jaicAFl9PiaL8arG6cKHrxv Lei1VyaCl6cKHwEr3nDLolTV6tjuAEoQzVtA7zPjNq6Y+bLYczd7UulNjtkvb1ktVagE 9iWn/B/Mpcv+cC4kRWbSRkVz54XTHoR8E2uF7UUOHuJtE0bht4717ZuZ2rHVMlYe8c9J Y0jTitbuyGM8VPtfuqOFHmeM3x1udPj3IGCYj+SWpyx1NuiG2PQRFqietK9IGZKiU89F 92/Y3P+zOq41FkeCf57L5RFmOyxPi7eCUnMaQeCld8fvs43lGphExJ2i1ujPWl6QcT96 S0jQ== X-Gm-Message-State: AA+aEWbhLQeQDZTah7yNzjjOGBV1BriuPdrgfWc3+skM/gN3C6v6Trf7 lYCxFThQb9iCiw2B/f3l6rfAhQ== X-Received: by 2002:a17:902:24a2:: with SMTP id w31mr13337207pla.216.1545070631226; Mon, 17 Dec 2018 10:17:11 -0800 (PST) Received: from xeon-e3 (204-195-22-127.wavecable.com. [204.195.22.127]) by smtp.gmail.com with ESMTPSA id 83sm21505378pgf.57.2018.12.17.10.17.10 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 17 Dec 2018 10:17:11 -0800 (PST) Date: Mon, 17 Dec 2018 10:17:03 -0800 From: Stephen Hemminger To: Dexuan Cui Cc: "'gregkh@linuxfoundation.org'" , KY Srinivasan , Haiyang Zhang , "'linux-kernel@vger.kernel.org'" , "'devel@linuxdriverproject.org'" , "'olaf@aepfle.de'" , "'jasowang@redhat.com'" , Michael Kelley , Sasha Levin , "'apw@canonical.com'" , vkuznets Subject: Re: [PATCH] Drivers: hv: vmbus: Return -EINVAL for the sys files for unopened channels Message-ID: <20181217101703.78e8bb3f@xeon-e3> In-Reply-To: References: <20181217091518.5004d4c7@xeon-e3> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 17 Dec 2018 18:00:29 +0000 Dexuan Cui wrote: > > From: Stephen Hemminger > > On Thu, 13 Dec 2018 16:35:43 +0000 > > Dexuan Cui wrote: > > > > > Before 98f4c651762c, we returned zeros for unopened channels. > > > With 98f4c651762c, we started to return random on-stack values. > > > > > > We'd better return -EINVAL instead. > > > > The concept looks fine, but maybe it would be simpler to move it into > > hv_ringbuffer_get_debuginfo and have it return an error code. > > > > Since so much of the code is repeated, I would probably make a > > macro which generates the code as well. > > > > Something like this: > > Thanks, Stephen! Now the patch has been in char-misc's char-misc-linus > branch, so IMO we may as well leave it as is (considering the code here is > unlikely to be frqeuencly changed), and we have a smaller patch this way. :-) > > But, yes, I agree with you that generally we should make a common > function to avoid duplicate code. > > Thanks, > -- Dexuan The old code was risky because it would silently return stack garbage. Having an error check in get_debuginfo would eliminate that.