Re: [PATCH] Drivers: hv: vmbus: Return -EINVAL for the sys files for unopened channels

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

> > From: Stephen Hemminger <stephen@xxxxxxxxxxxxxxxxxx>
> > On Thu, 13 Dec 2018 16:35:43 +0000
> > Dexuan Cui <decui@xxxxxxxxxxxxx> 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.
_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel



[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux