Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 27 May 2025 19:32:43 GMT
From:      Navdeep Parhar <np@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 9a4e5a8a714c - stable/14 - pciconf(8): Dump the correct number of bytes
Message-ID:  <202505271932.54RJWhCV090666@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/14 has been updated by np:

URL: https://cgit.FreeBSD.org/src/commit/?id=9a4e5a8a714cf8f5497b7c9b8944a13e19be0eb7

commit 9a4e5a8a714cf8f5497b7c9b8944a13e19be0eb7
Author:     Navdeep Parhar <np@FreeBSD.org>
AuthorDate: 2025-05-19 06:26:46 +0000
Commit:     Navdeep Parhar <np@FreeBSD.org>
CommitDate: 2025-05-27 16:59:51 +0000

    pciconf(8): Dump the correct number of bytes
    
    The loop variable should be incremented by 1 and not the width.
    
    Reviewed by:    kib
    Sponsored by:   Chelsio Communications
    Differential Revision:  https://reviews.freebsd.org/D50422
    
    (cherry picked from commit 9fb60477fe260da2db029baebe63331d0f584a3d)
---
 usr.sbin/pciconf/pciconf.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/usr.sbin/pciconf/pciconf.c b/usr.sbin/pciconf/pciconf.c
index ef75a8fa2341..4d3941131858 100644
--- a/usr.sbin/pciconf/pciconf.c
+++ b/usr.sbin/pciconf/pciconf.c
@@ -1153,7 +1153,7 @@ dump_bar(const char *name, const char *reg, const char *bar_start,
 	case 1:
 		db = (uint8_t *)(uintptr_t)((uintptr_t)pbm.pbm_map_base +
 		    pbm.pbm_bar_off + start * width);
-		for (a = 0; a < count; a += width, db++) {
+		for (a = 0; a < count; a++, db++) {
 			res = fwrite(db, width, 1, stdout);
 			if (res != 1) {
 				errx(1, "error writing to stdout");
@@ -1164,7 +1164,7 @@ dump_bar(const char *name, const char *reg, const char *bar_start,
 	case 2:
 		dh = (uint16_t *)(uintptr_t)((uintptr_t)pbm.pbm_map_base +
 		    pbm.pbm_bar_off + start * width);
-		for (a = 0; a < count; a += width, dh++) {
+		for (a = 0; a < count; a++, dh++) {
 			res = fwrite(dh, width, 1, stdout);
 			if (res != 1) {
 				errx(1, "error writing to stdout");
@@ -1175,7 +1175,7 @@ dump_bar(const char *name, const char *reg, const char *bar_start,
 	case 4:
 		dd = (uint32_t *)(uintptr_t)((uintptr_t)pbm.pbm_map_base +
 		    pbm.pbm_bar_off + start * width);
-		for (a = 0; a < count; a += width, dd++) {
+		for (a = 0; a < count; a ++, dd++) {
 			res = fwrite(dd, width, 1, stdout);
 			if (res != 1) {
 				errx(1, "error writing to stdout");
@@ -1186,7 +1186,7 @@ dump_bar(const char *name, const char *reg, const char *bar_start,
 	case 8:
 		dx = (uint64_t *)(uintptr_t)((uintptr_t)pbm.pbm_map_base +
 		    pbm.pbm_bar_off + start * width);
-		for (a = 0; a < count; a += width, dx++) {
+		for (a = 0; a < count; a++, dx++) {
 			res = fwrite(dx, width, 1, stdout);
 			if (res != 1) {
 				errx(1, "error writing to stdout");



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