diff options
author | Joel Sing <jsing@cvs.openbsd.org> | 2009-09-03 13:26:39 +0000 |
---|---|---|
committer | Joel Sing <jsing@cvs.openbsd.org> | 2009-09-03 13:26:39 +0000 |
commit | dd0fa00b9e3f89643075b69dadaf9c80d7f8b5d1 (patch) | |
tree | 676f1d35b0c027a8ac1c4cdff4e35e20ffd0a078 | |
parent | 5abc289cb7985382547c579c6f800d9c82b8d5b7 (diff) |
Check the return value of copyin().
ok marco@
-rw-r--r-- | sys/dev/softraid.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/sys/dev/softraid.c b/sys/dev/softraid.c index 5162f0c81a3..29563b33277 100644 --- a/sys/dev/softraid.c +++ b/sys/dev/softraid.c @@ -1,4 +1,4 @@ -/* $OpenBSD: softraid.c,v 1.172 2009/09/03 13:20:29 jsing Exp $ */ +/* $OpenBSD: softraid.c,v 1.173 2009/09/03 13:26:38 jsing Exp $ */ /* * Copyright (c) 2007, 2008, 2009 Marco Peereboom <marco@peereboom.us> * Copyright (c) 2008 Chris Kuethe <ckuethe@openbsd.org> @@ -2693,9 +2693,10 @@ sr_ioctl_createraid(struct sr_softc *sc, struct bioc_createraid *bc, int user) goto unwind; dt = malloc(bc->bc_dev_list_len, M_DEVBUF, M_WAITOK | M_ZERO); - if (user) - copyin(bc->bc_dev_list, dt, bc->bc_dev_list_len); - else + if (user) { + if (copyin(bc->bc_dev_list, dt, bc->bc_dev_list_len) != 0) + goto unwind; + } else bcopy(bc->bc_dev_list, dt, bc->bc_dev_list_len); sd = malloc(sizeof(struct sr_discipline), M_DEVBUF, M_WAITOK | M_ZERO); |