Attention is currently required from: Edward O'Callaghan, Angel Pons, Nikolai Artemiev.

Nico Huber would like build bot (Jenkins), Edward O'Callaghan, Angel Pons and Nikolai Artemiev to review this change.

View Change

linux_mtd: check ioctl() return value properly

Make the linux_mtd driver treat any negative return value from the
MEMERASE ioctl as an error. Previously it only treated -1 as an error.

BUG=b:213561594,b:210973586,b:182223106
BRANCH=none
TEST=builds

Change-Id: I40cfbdee2ab608fbe6c17d9cac6ec53ff224d9a4
Signed-off-by: Nikolai Artemiev <nartemiev@google.com>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/60996
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Reviewed-by: Edward O'Callaghan <quasisec@chromium.org>
---
M linux_mtd.c
1 file changed, 26 insertions(+), 3 deletions(-)

git pull ssh://review.coreboot.org:29418/flashrom refs/changes/57/67857/1
diff --git a/linux_mtd.c b/linux_mtd.c
index 75dce1f..7052e5d 100644
--- a/linux_mtd.c
+++ b/linux_mtd.c
@@ -280,9 +280,11 @@
.length = mtd_erasesize,
};

- if (ioctl(fileno(dev_fp), MEMERASE, &erase_info) == -1) {
- msg_perr("%s: ioctl: %s\n", __func__, strerror(errno));
- return 1;
+ int ret = ioctl(fileno(dev_fp), MEMERASE, &erase_info);
+ if (ret < 0) {
+ msg_perr("%s: MEMERASE ioctl call returned %d, error: %s\n",
+ __func__, ret, strerror(errno));
+ return 1;
}
}


To view, visit change 67857. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: flashrom
Gerrit-Branch: 1.1.x
Gerrit-Change-Id: I40cfbdee2ab608fbe6c17d9cac6ec53ff224d9a4
Gerrit-Change-Number: 67857
Gerrit-PatchSet: 1
Gerrit-Owner: Nico Huber <nico.h@gmx.de>
Gerrit-Reviewer: Angel Pons <th3fanbus@gmail.com>
Gerrit-Reviewer: Edward O'Callaghan <quasisec@chromium.org>
Gerrit-Reviewer: Nikolai Artemiev <nartemiev@google.com>
Gerrit-Reviewer: build bot (Jenkins) <no-reply@coreboot.org>
Gerrit-Attention: Edward O'Callaghan <quasisec@chromium.org>
Gerrit-Attention: Angel Pons <th3fanbus@gmail.com>
Gerrit-Attention: Nikolai Artemiev <nartemiev@google.com>
Gerrit-MessageType: newchange