All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: Dexuan Cui <decui@microsoft.com>
Cc: "'gregkh@linuxfoundation.org'" <gregkh@linuxfoundation.org>,
	KY Srinivasan <kys@microsoft.com>,
	Haiyang Zhang <haiyangz@microsoft.com>,
	"'linux-kernel@vger.kernel.org'" <linux-kernel@vger.kernel.org>,
	"'devel@linuxdriverproject.org'" <devel@linuxdriverproject.org>,
	"'olaf@aepfle.de'" <olaf@aepfle.de>,
	"'jasowang@redhat.com'" <jasowang@redhat.com>,
	Michael Kelley <mikelley@microsoft.com>,
	Sasha Levin <Alexander.Levin@microsoft.com>,
	"'apw@canonical.com'" <apw@canonical.com>,
	vkuznets <vkuznets@redhat.com>
Subject: Re: [PATCH] Drivers: hv: vmbus: Return -EINVAL for the sys files for unopened channels
Date: Mon, 17 Dec 2018 10:17:03 -0800	[thread overview]
Message-ID: <20181217101703.78e8bb3f@xeon-e3> (raw)
In-Reply-To: <PU1P153MB0169725E468897F135F2155BBFBC0@PU1P153MB0169.APCP153.PROD.OUTLOOK.COM>

On Mon, 17 Dec 2018 18:00:29 +0000
Dexuan Cui <decui@microsoft.com> wrote:

> > From: Stephen Hemminger <stephen@networkplumber.org>
> > On Thu, 13 Dec 2018 16:35:43 +0000
> > Dexuan Cui <decui@microsoft.com> 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.

  reply	other threads:[~2018-12-17 18:17 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-13 16:35 [PATCH] Drivers: hv: vmbus: Return -EINVAL for the sys files for unopened channels Dexuan Cui
2018-12-13 19:59 ` Sasha Levin
2018-12-17 17:15 ` Stephen Hemminger
2018-12-17 18:00   ` Dexuan Cui
2018-12-17 18:17     ` Stephen Hemminger [this message]
2018-12-17 18:31       ` Dexuan Cui
2018-12-17 18:44         ` Dexuan Cui
2018-12-17 20:35           ` Stephen Hemminger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181217101703.78e8bb3f@xeon-e3 \
    --to=stephen@networkplumber.org \
    --cc=Alexander.Levin@microsoft.com \
    --cc=apw@canonical.com \
    --cc=decui@microsoft.com \
    --cc=devel@linuxdriverproject.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=haiyangz@microsoft.com \
    --cc=jasowang@redhat.com \
    --cc=kys@microsoft.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mikelley@microsoft.com \
    --cc=olaf@aepfle.de \
    --cc=vkuznets@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.