From 16dd45cbc81f1882781087fc31b6b979186f81c2 Mon Sep 17 00:00:00 2001 From: ken Date: Tue, 25 May 1999 17:10:04 +0000 Subject: Fix the read/write permission checks in cam_periph_mapmem(). If we're writing, we want to be able to read the buffer. If we're reading, we want to be able to write to the buffer. PR: kern/11870 Submitted by: Andrew Mobbs --- sys/cam/cam_periph.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'sys/cam/cam_periph.c') diff --git a/sys/cam/cam_periph.c b/sys/cam/cam_periph.c index 240e063..4068c68 100644 --- a/sys/cam/cam_periph.c +++ b/sys/cam/cam_periph.c @@ -2,7 +2,7 @@ * Common functions for CAM "type" (peripheral) drivers. * * Copyright (c) 1997, 1998 Justin T. Gibbs. - * Copyright (c) 1997, 1998 Kenneth D. Merry. + * Copyright (c) 1997, 1998, 1999 Kenneth D. Merry. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -26,7 +26,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: cam_periph.c,v 1.14 1999/05/22 21:58:45 gibbs Exp $ + * $Id: cam_periph.c,v 1.15 1999/05/23 18:57:29 gibbs Exp $ */ #include @@ -559,7 +559,7 @@ cam_periph_mapmem(union ccb *ccb, struct cam_periph_map_info *mapinfo) return(E2BIG); } - if (dirs[i] & CAM_DIR_IN) { + if (dirs[i] & CAM_DIR_OUT) { flags[i] = B_READ; if (useracc(*data_ptrs[i], lengths[i], B_READ) == 0){ printf("cam_periph_mapmem: error, " @@ -575,7 +575,7 @@ cam_periph_mapmem(union ccb *ccb, struct cam_periph_map_info *mapinfo) * XXX this check is really bogus, since B_WRITE currently * is all 0's, and so it is "set" all the time. */ - if (dirs[i] & CAM_DIR_OUT) { + if (dirs[i] & CAM_DIR_IN) { flags[i] |= B_WRITE; if (useracc(*data_ptrs[i], lengths[i], B_WRITE) == 0){ printf("cam_periph_mapmem: error, " -- cgit v1.1