Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 14 Dec 2016 19:28:19 +0000 (UTC)
From:      Dimitry Andric <dim@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r310086 - head/sys/dev/xen/blkfront
Message-ID:  <201612141928.uBEJSJor074348@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: dim
Date: Wed Dec 14 19:28:19 2016
New Revision: 310086
URL: https://svnweb.freebsd.org/changeset/base/310086

Log:
  In xbd_connect(), use correct scanf conversion specifiers for the
  feature_barrier and feature_flush variables.  Otherwise, adjacent
  variables on the stack, such as sector_size, may be overwritten, with
  disastrous results.
  
  Note that I did not see a good reason to revert the addition of zero
  checks introduced in r310013.  Better safe than sorry.
  
  PR:		215209
  Tested by:	royger
  MFC after:	3 days

Modified:
  head/sys/dev/xen/blkfront/blkfront.c

Modified: head/sys/dev/xen/blkfront/blkfront.c
==============================================================================
--- head/sys/dev/xen/blkfront/blkfront.c	Wed Dec 14 19:01:43 2016	(r310085)
+++ head/sys/dev/xen/blkfront/blkfront.c	Wed Dec 14 19:28:19 2016	(r310086)
@@ -1259,13 +1259,13 @@ xbd_connect(struct xbd_softc *sc)
 	if (err || phys_sector_size <= sector_size)
 		phys_sector_size = 0;
 	err = xs_gather(XST_NIL, xenbus_get_otherend_path(dev),
-	     "feature-barrier", "%lu", &feature_barrier,
+	     "feature-barrier", "%d", &feature_barrier,
 	     NULL);
 	if (err == 0 && feature_barrier != 0)
 		sc->xbd_flags |= XBDF_BARRIER;
 
 	err = xs_gather(XST_NIL, xenbus_get_otherend_path(dev),
-	     "feature-flush-cache", "%lu", &feature_flush,
+	     "feature-flush-cache", "%d", &feature_flush,
 	     NULL);
 	if (err == 0 && feature_flush != 0)
 		sc->xbd_flags |= XBDF_FLUSH;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201612141928.uBEJSJor074348>