Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys Fix some code paths where pointers are dereferenced afte...



details:   https://anonhg.NetBSD.org/src/rev/40a582d5066f
branches:  trunk
changeset: 757101:40a582d5066f
user:      jym <jym%NetBSD.org@localhost>
date:      Sat Aug 14 18:28:59 2010 +0000

description:
Fix some code paths where pointers are dereferenced after checking that
they are NULL (oops?)

XXX pull-ups for NetBSD-4 and NetBSD-5.

diffstat:

 sys/dev/ieee1394/firewire.c |   8 ++++----
 sys/netinet6/esp_aesctr.c   |  10 +++++-----
 sys/netinet6/esp_core.c     |   9 +++++----
 3 files changed, 14 insertions(+), 13 deletions(-)

diffs (99 lines):

diff -r cab1271a8d01 -r 40a582d5066f sys/dev/ieee1394/firewire.c
--- a/sys/dev/ieee1394/firewire.c       Sat Aug 14 17:50:57 2010 +0000
+++ b/sys/dev/ieee1394/firewire.c       Sat Aug 14 18:28:59 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: firewire.c,v 1.35 2010/05/23 18:56:58 christos Exp $   */
+/*     $NetBSD: firewire.c,v 1.36 2010/08/14 18:28:59 jym Exp $        */
 /*-
  * Copyright (c) 2003 Hidetoshi Shimokawa
  * Copyright (c) 1998-2002 Katsushi Kobayashi and Hidetoshi Shimokawa
@@ -37,7 +37,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: firewire.c,v 1.35 2010/05/23 18:56:58 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: firewire.c,v 1.36 2010/08/14 18:28:59 jym Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -907,7 +907,7 @@
 {
 
        if (xfer == NULL) {
-               aprint_error_dev(xfer->fc->bdev, "xfer == NULL\n");
+               aprint_error("fw_xfer_free: xfer == NULL\n");
                return;
        }
        fw_xfer_unload(xfer);
@@ -920,7 +920,7 @@
 {
 
        if (xfer == NULL) {
-               aprint_error_dev(xfer->fc->bdev, "xfer == NULL\n");
+               aprint_error("fw_xfer_free_buf: xfer == NULL\n");
                return;
        }
        fw_xfer_unload(xfer);
diff -r cab1271a8d01 -r 40a582d5066f sys/netinet6/esp_aesctr.c
--- a/sys/netinet6/esp_aesctr.c Sat Aug 14 17:50:57 2010 +0000
+++ b/sys/netinet6/esp_aesctr.c Sat Aug 14 18:28:59 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: esp_aesctr.c,v 1.12 2009/04/18 14:58:05 tsutsui Exp $  */
+/*     $NetBSD: esp_aesctr.c,v 1.13 2010/08/14 18:28:59 jym Exp $      */
 /*     $KAME: esp_aesctr.c,v 1.2 2003/07/20 00:29:37 itojun Exp $      */
 
 /*
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: esp_aesctr.c,v 1.12 2009/04/18 14:58:05 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: esp_aesctr.c,v 1.13 2010/08/14 18:28:59 jym Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -79,10 +79,10 @@
        const struct esp_algorithm *algo;
 
        algo = esp_algorithm_lookup(sav->alg_enc);
-       if (!algo) {
+       if (algo == NULL) {
                ipseclog((LOG_ERR,
-                   "esp_aeesctr_mature %s: unsupported algorithm.\n",
-                   algo->name));
+                   "esp_aesctr_mature: unsupported encryption algorithm %d\n",
+                   sav->alg_enc));
                return 1;
        }
 
diff -r cab1271a8d01 -r 40a582d5066f sys/netinet6/esp_core.c
--- a/sys/netinet6/esp_core.c   Sat Aug 14 17:50:57 2010 +0000
+++ b/sys/netinet6/esp_core.c   Sat Aug 14 18:28:59 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: esp_core.c,v 1.45 2009/04/18 14:58:05 tsutsui Exp $    */
+/*     $NetBSD: esp_core.c,v 1.46 2010/08/14 18:28:59 jym Exp $        */
 /*     $KAME: esp_core.c,v 1.53 2001/11/27 09:47:30 sakane Exp $       */
 
 /*
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: esp_core.c,v 1.45 2009/04/18 14:58:05 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: esp_core.c,v 1.46 2010/08/14 18:28:59 jym Exp $");
 
 #include "opt_inet.h"
 
@@ -404,9 +404,10 @@
        }
 
        algo = esp_algorithm_lookup(sav->alg_enc);
-       if (!algo) {
+       if (algo == NULL) {
                ipseclog((LOG_ERR,
-                   "esp_cbc_mature %s: unsupported algorithm.\n", algo->name));
+                   "esp_cbc_mature: unsupported encryption algorithm %d\n",
+                   sav->alg_enc));
                return 1;
        }
 



Home | Main Index | Thread Index | Old Index