From: patrick Date: Wed, 2 Jun 2021 19:11:02 +0000 (+0000) Subject: Correctly calculate number of PRPL entries we have to sync by adding X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=e4727810e47f0bbfba038e5c30bc215ab47ae6d6;p=openbsd Correctly calculate number of PRPL entries we have to sync by adding brackets to manage operator precedence. Otherwise we'd attempt to sync more than needed, which doesn't cause issues, but it's still wrong. ok dlg@ jmatthew@ --- diff --git a/sys/dev/ic/nvme.c b/sys/dev/ic/nvme.c index 62b8e40c626..dc220002549 100644 --- a/sys/dev/ic/nvme.c +++ b/sys/dev/ic/nvme.c @@ -1,4 +1,4 @@ -/* $OpenBSD: nvme.c,v 1.99 2021/05/31 04:48:35 dlg Exp $ */ +/* $OpenBSD: nvme.c,v 1.100 2021/06/02 19:11:02 patrick Exp $ */ /* * Copyright (c) 2014 David Gwynne @@ -629,7 +629,7 @@ nvme_scsi_io(struct scsi_xfer *xs, int dir) bus_dmamap_sync(sc->sc_dmat, NVME_DMA_MAP(sc->sc_ccb_prpls), ccb->ccb_prpl_off, - sizeof(*ccb->ccb_prpl) * dmap->dm_nsegs - 1, + sizeof(*ccb->ccb_prpl) * (dmap->dm_nsegs - 1), BUS_DMASYNC_PREWRITE); } @@ -691,7 +691,7 @@ nvme_scsi_io_done(struct nvme_softc *sc, struct nvme_ccb *ccb, bus_dmamap_sync(sc->sc_dmat, NVME_DMA_MAP(sc->sc_ccb_prpls), ccb->ccb_prpl_off, - sizeof(*ccb->ccb_prpl) * dmap->dm_nsegs - 1, + sizeof(*ccb->ccb_prpl) * (dmap->dm_nsegs - 1), BUS_DMASYNC_POSTWRITE); }