Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/fs/v7fs Insert casts to off_t to avoid 32-bit multiplica...
details: https://anonhg.NetBSD.org/src/rev/0f3e3f60fced
branches: trunk
changeset: 767927:0f3e3f60fced
user: dholland <dholland%NetBSD.org@localhost>
date: Wed Aug 03 16:21:52 2011 +0000
description:
Insert casts to off_t to avoid 32-bit multiplication overflow when
computing device offsets on 32-bit platforms. Should fix PR 45191.
diffstat:
sys/fs/v7fs/v7fs_io_user.c | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
diffs (36 lines):
diff -r 81762e460ad7 -r 0f3e3f60fced sys/fs/v7fs/v7fs_io_user.c
--- a/sys/fs/v7fs/v7fs_io_user.c Wed Aug 03 15:44:15 2011 +0000
+++ b/sys/fs/v7fs/v7fs_io_user.c Wed Aug 03 16:21:52 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: v7fs_io_user.c,v 1.2 2011/07/18 21:51:49 apb Exp $ */
+/* $NetBSD: v7fs_io_user.c,v 1.3 2011/08/03 16:21:52 dholland Exp $ */
/*-
* Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: v7fs_io_user.c,v 1.2 2011/07/18 21:51:49 apb Exp $");
+__RCSID("$NetBSD: v7fs_io_user.c,v 1.3 2011/08/03 16:21:52 dholland Exp $");
#endif /* not lint */
#include <stdio.h>
@@ -125,7 +125,7 @@
size_t blksz = lio->blksz;
int fd = lio->fd;
- if ((lseek(fd, sector * blksz, SEEK_SET) < 0) ||
+ if ((lseek(fd, (off_t)sector * blksz, SEEK_SET) < 0) ||
(read(fd, buf, blksz) < (ssize_t)blksz)) {
warn("sector=%ld\n", (long)sector);
return false;
@@ -141,7 +141,7 @@
size_t blksz = lio->blksz;
int fd = lio->fd;
- if ((lseek(fd, sector * blksz, SEEK_SET) < 0) ||
+ if ((lseek(fd, (off_t)sector * blksz, SEEK_SET) < 0) ||
(write(fd, buf, blksz) < (ssize_t)blksz)) {
warn("sector=%ld\n", (long)sector);
return false;
Home |
Main Index |
Thread Index |
Old Index