diff mbox

xen-tpmfront: correct return value check on xenbus_scanf()

Message ID 577E291002000078000FBF18@prv-mh.provo.novell.com (mailing list archive)
State New, archived
Headers show

Commit Message

Jan Beulich July 7, 2016, 8:04 a.m. UTC
Only a positive return value indicates success.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
---
 drivers/char/tpm/xen-tpmfront.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)





------------------------------------------------------------------------------
Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in San
Francisco, CA to explore cutting-edge tech and listen to tech luminaries
present their vision of the future. This family event has something for
everyone, including kids. Get more information and register today.
http://sdm.link/attshape

Comments

Jarkko Sakkinen July 7, 2016, 10:35 a.m. UTC | #1
On Thu, Jul 07, 2016 at 02:04:00AM -0600, Jan Beulich wrote:
> Only a positive return value indicates success.
> 
> Signed-off-by: Jan Beulich <jbeulich@suse.com>

Reviewed-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>

/Jarkko

> ---
>  drivers/char/tpm/xen-tpmfront.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> --- 4.7-rc6-xenbus_scanf.orig/drivers/char/tpm/xen-tpmfront.c
> +++ 4.7-rc6-xenbus_scanf/drivers/char/tpm/xen-tpmfront.c
> @@ -344,7 +344,7 @@ static void backend_changed(struct xenbu
>  			break;
>  
>  		if (xenbus_scanf(XBT_NIL, dev->otherend,
> -				"feature-protocol-v2", "%d", &val) < 0)
> +				"feature-protocol-v2", "%d", &val) <= 0)
>  			val = 0;
>  		if (!val) {
>  			xenbus_dev_fatal(dev, -EINVAL,
> 
> 
> 

------------------------------------------------------------------------------
Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in San
Francisco, CA to explore cutting-edge tech and listen to tech luminaries
present their vision of the future. This family event has something for
everyone, including kids. Get more information and register today.
http://sdm.link/attshape
Jarkko Sakkinen July 7, 2016, 10:38 a.m. UTC | #2
On Thu, Jul 07, 2016 at 01:35:54PM +0300, Jarkko Sakkinen wrote:
> On Thu, Jul 07, 2016 at 02:04:00AM -0600, Jan Beulich wrote:
> > Only a positive return value indicates success.
> > 
> > Signed-off-by: Jan Beulich <jbeulich@suse.com>
> 
> Reviewed-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>

Applied. Should this be CC'd to stable or not?

/Jarkko

> /Jarkko
> 
> > ---
> >  drivers/char/tpm/xen-tpmfront.c |    2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > --- 4.7-rc6-xenbus_scanf.orig/drivers/char/tpm/xen-tpmfront.c
> > +++ 4.7-rc6-xenbus_scanf/drivers/char/tpm/xen-tpmfront.c
> > @@ -344,7 +344,7 @@ static void backend_changed(struct xenbu
> >  			break;
> >  
> >  		if (xenbus_scanf(XBT_NIL, dev->otherend,
> > -				"feature-protocol-v2", "%d", &val) < 0)
> > +				"feature-protocol-v2", "%d", &val) <= 0)
> >  			val = 0;
> >  		if (!val) {
> >  			xenbus_dev_fatal(dev, -EINVAL,
> > 
> > 
> > 

------------------------------------------------------------------------------
Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in San
Francisco, CA to explore cutting-edge tech and listen to tech luminaries
present their vision of the future. This family event has something for
everyone, including kids. Get more information and register today.
http://sdm.link/attshape
Jan Beulich July 7, 2016, noon UTC | #3
>>> On 07.07.16 at 12:38, <jarkko.sakkinen@linux.intel.com> wrote:
> On Thu, Jul 07, 2016 at 01:35:54PM +0300, Jarkko Sakkinen wrote:
>> On Thu, Jul 07, 2016 at 02:04:00AM -0600, Jan Beulich wrote:
>> > Only a positive return value indicates success.
>> > 
>> > Signed-off-by: Jan Beulich <jbeulich@suse.com>
>> 
>> Reviewed-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
> 
> Applied. Should this be CC'd to stable or not?

Actually the Xen code maintainers dislike this kind of change
(expressed in reply to a change elsewhere in the tree), so
maybe you want to sync with them whether to pull it back out.
In any event I don't think it needs Cc-ing to stable@.

Jan


------------------------------------------------------------------------------
Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in San
Francisco, CA to explore cutting-edge tech and listen to tech luminaries
present their vision of the future. This family event has something for
everyone, including kids. Get more information and register today.
http://sdm.link/attshape
Jarkko Sakkinen July 7, 2016, 12:21 p.m. UTC | #4
On Thu, Jul 07, 2016 at 06:00:25AM -0600, Jan Beulich wrote:
> >>> On 07.07.16 at 12:38, <jarkko.sakkinen@linux.intel.com> wrote:
> > On Thu, Jul 07, 2016 at 01:35:54PM +0300, Jarkko Sakkinen wrote:
> >> On Thu, Jul 07, 2016 at 02:04:00AM -0600, Jan Beulich wrote:
> >> > Only a positive return value indicates success.
> >> > 
> >> > Signed-off-by: Jan Beulich <jbeulich@suse.com>
> >> 
> >> Reviewed-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
> > 
> > Applied. Should this be CC'd to stable or not?
> 
> Actually the Xen code maintainers dislike this kind of change
> (expressed in reply to a change elsewhere in the tree), so
> maybe you want to sync with them whether to pull it back out.
> In any event I don't think it needs Cc-ing to stable@.

OK, it's in my master branch (bleeding edge) so no harm done yet.

> Jan

/Jarkko

------------------------------------------------------------------------------
Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in San
Francisco, CA to explore cutting-edge tech and listen to tech luminaries
present their vision of the future. This family event has something for
everyone, including kids. Get more information and register today.
http://sdm.link/attshape
diff mbox

Patch

--- 4.7-rc6-xenbus_scanf.orig/drivers/char/tpm/xen-tpmfront.c
+++ 4.7-rc6-xenbus_scanf/drivers/char/tpm/xen-tpmfront.c
@@ -344,7 +344,7 @@  static void backend_changed(struct xenbu
 			break;
 
 		if (xenbus_scanf(XBT_NIL, dev->otherend,
-				"feature-protocol-v2", "%d", &val) < 0)
+				"feature-protocol-v2", "%d", &val) <= 0)
 			val = 0;
 		if (!val) {
 			xenbus_dev_fatal(dev, -EINVAL,