diff options
| author | Leah Rowe <leah@libreboot.org> | 2026-03-16 18:28:36 +0000 |
|---|---|---|
| committer | Leah Rowe <leah@libreboot.org> | 2026-03-26 06:59:41 +0000 |
| commit | 5ce5ac2994e53bf699157afdebc6700af653d9ae (patch) | |
| tree | bc698e02af577416a50de02af469cef84c130b1c /util/nvmutil/nvmutil.c | |
| parent | 7b62a1653bb6fe48a6ca8b7138e2b3138f854a54 (diff) | |
pointer safety
Signed-off-by: Leah Rowe <leah@libreboot.org>
Diffstat (limited to 'util/nvmutil/nvmutil.c')
| -rw-r--r-- | util/nvmutil/nvmutil.c | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/util/nvmutil/nvmutil.c b/util/nvmutil/nvmutil.c index d85bd1ce..e54197b5 100644 --- a/util/nvmutil/nvmutil.c +++ b/util/nvmutil/nvmutil.c @@ -2251,21 +2251,16 @@ long rw_gbe_file_exact(int fd, unsigned char *mem, unsigned long nrw, off_t off, int rw_type) { - unsigned long mem_addr; - unsigned long buf_addr; long r; if (io_args(fd, mem, nrw, off, rw_type) == -1) return -1; - mem_addr = (unsigned long)(void *)mem; - buf_addr = (unsigned long)(void *)buf; - if (mem != (void *)pad) { - if (mem_addr < buf_addr) + if (mem < buf) goto err_rw_gbe_file_exact; - if ((mem_addr - buf_addr) >= (unsigned long)GBE_WORK_SIZE) + if ((unsigned long)(mem - buf) >= GBE_WORK_SIZE) goto err_rw_gbe_file_exact; } |
