From owner-svn-src-all@freebsd.org Thu May 28 08:19:14 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7050E32A276; Thu, 28 May 2020 08:19:14 +0000 (UTC) (envelope-from royger@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49Xgb62L64z48xQ; Thu, 28 May 2020 08:19:14 +0000 (UTC) (envelope-from royger@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4B5BB232C3; Thu, 28 May 2020 08:19:14 +0000 (UTC) (envelope-from royger@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 04S8JEBi075885; Thu, 28 May 2020 08:19:14 GMT (envelope-from royger@FreeBSD.org) Received: (from royger@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 04S8JEGh075884; Thu, 28 May 2020 08:19:14 GMT (envelope-from royger@FreeBSD.org) Message-Id: <202005280819.04S8JEGh075884@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: royger set sender to royger@FreeBSD.org using -f From: =?UTF-8?Q?Roger_Pau_Monn=c3=a9?= Date: Thu, 28 May 2020 08:19:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r361579 - head/sys/dev/xen/blkfront X-SVN-Group: head X-SVN-Commit-Author: royger X-SVN-Commit-Paths: head/sys/dev/xen/blkfront X-SVN-Commit-Revision: 361579 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 May 2020 08:19:14 -0000 Author: royger Date: Thu May 28 08:19:13 2020 New Revision: 361579 URL: https://svnweb.freebsd.org/changeset/base/361579 Log: xen/blkfront: use the correct type for disk sectors The correct type to use to represent disk sectors is blkif_sector_t (which is an uint64_t underneath). This avoid truncation of the disk size calculation when resizing on i386, as otherwise the calculation of d_mediasize in xbd_connect is truncated to the size of unsigned long, which is 32bits on i386. Note this issue didn't affect amd64, because the size of unsigned long is 64bits there. Sponsored by: Citrix Systems R&D MFC after: 1 week Modified: head/sys/dev/xen/blkfront/blkfront.c Modified: head/sys/dev/xen/blkfront/blkfront.c ============================================================================== --- head/sys/dev/xen/blkfront/blkfront.c Thu May 28 08:18:34 2020 (r361578) +++ head/sys/dev/xen/blkfront/blkfront.c Thu May 28 08:19:13 2020 (r361579) @@ -1225,7 +1225,8 @@ static void xbd_connect(struct xbd_softc *sc) { device_t dev = sc->xbd_dev; - unsigned long sectors, sector_size, phys_sector_size; + blkif_sector_t sectors; + unsigned long sector_size, phys_sector_size; unsigned int binfo; int err, feature_barrier, feature_flush; int i, j; @@ -1244,7 +1245,7 @@ xbd_connect(struct xbd_softc *sc) return; } err = xs_gather(XST_NIL, xenbus_get_otherend_path(dev), - "sectors", "%lu", §ors, NULL); + "sectors", "%"PRIu64, §ors, NULL); if (err != 0) { xenbus_dev_error(dev, err, "reading sectors at %s", @@ -1266,7 +1267,7 @@ xbd_connect(struct xbd_softc *sc) } err = xs_gather(XST_NIL, xenbus_get_otherend_path(dev), - "sectors", "%lu", §ors, + "sectors", "%"PRIu64, §ors, "info", "%u", &binfo, "sector-size", "%lu", §or_size, NULL); @@ -1279,7 +1280,7 @@ xbd_connect(struct xbd_softc *sc) if ((sectors == 0) || (sector_size == 0)) { xenbus_dev_fatal(dev, 0, "invalid parameters from %s:" - " sectors = %lu, sector_size = %lu", + " sectors = %"PRIu64", sector_size = %lu", xenbus_get_otherend_path(dev), sectors, sector_size); return;