Module Name: src
Committed By: dholland
Date: Wed Aug 3 16:21:52 UTC 2011
Modified Files:
src/sys/fs/v7fs: v7fs_io_user.c
Log Message:
Insert casts to off_t to avoid 32-bit multiplication overflow when
computing device offsets on 32-bit platforms. Should fix PR 45191.
To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/fs/v7fs/v7fs_io_user.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/fs/v7fs/v7fs_io_user.c
diff -u src/sys/fs/v7fs/v7fs_io_user.c:1.2 src/sys/fs/v7fs/v7fs_io_user.c:1.3
--- src/sys/fs/v7fs/v7fs_io_user.c:1.2 Mon Jul 18 21:51:49 2011
+++ src/sys/fs/v7fs/v7fs_io_user.c Wed Aug 3 16:21:52 2011
@@ -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;