tech-kern archive

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

Re: Using coccinelle for (quick?) syntax fixing



On 10.08.2010 19:11, Matthias Drochner wrote:
> jeanyves.migeon%free.fr@localhost said:
>> But the NULL deref fixes will go in eventually, and I will probably
>> ask for a pull up too ;)
> 
> But then...
> 
>         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: NULL is not a valid algorithm.\n"));
>                 return 1;
> 
> The new error message if not helpful. How about printing alg_enc
> instead which is in a well-defined namespace.

Fixed

I will commit the attached patch on Saturday, unless someone objects.

-- 
Jean-Yves Migeon
jeanyves.migeon%free.fr@localhost
Index: dev/ieee1394/firewire.c
===================================================================
RCS file: /cvsroot/src/sys/dev/ieee1394/firewire.c,v
retrieving revision 1.35
diff -u -p -r1.35 firewire.c
--- dev/ieee1394/firewire.c     23 May 2010 18:56:58 -0000      1.35
+++ dev/ieee1394/firewire.c     11 Aug 2010 19:54:24 -0000
@@ -907,7 +907,7 @@ fw_xfer_free(struct fw_xfer* xfer)
 {
 
        if (xfer == NULL) {
-               aprint_error_dev(xfer->fc->bdev, "xfer == NULL\n");
+               aprint_error("%s: xfer == NULL\n", __func__);
                return;
        }
        fw_xfer_unload(xfer);
@@ -920,7 +920,7 @@ fw_xfer_free_buf(struct fw_xfer* xfer)
 {
 
        if (xfer == NULL) {
-               aprint_error_dev(xfer->fc->bdev, "xfer == NULL\n");
+               aprint_error("%s: xfer == NULL\n", __func__);
                return;
        }
        fw_xfer_unload(xfer);
Index: external/bsd/drm/dist/shared-core/radeon_cs.c
===================================================================
RCS file: /cvsroot/src/sys/external/bsd/drm/dist/shared-core/radeon_cs.c,v
retrieving revision 1.1
diff -u -p -r1.1 radeon_cs.c
--- external/bsd/drm/dist/shared-core/radeon_cs.c       24 May 2010 01:39:06 
-0000      1.1
+++ external/bsd/drm/dist/shared-core/radeon_cs.c       11 Aug 2010 19:54:26 
-0000
@@ -150,7 +150,6 @@ int radeon_cs_ioctl(struct drm_device *d
 
        if (dev_priv == NULL) {
                DRM_ERROR("called with no initialization\n");
-               DRM_SPINUNLOCK(&dev_priv->cs.cs_mutex);
                return -EINVAL;
        }
        if (!cs->num_chunks) {
Index: netinet6/esp_aesctr.c
===================================================================
RCS file: /cvsroot/src/sys/netinet6/esp_aesctr.c,v
retrieving revision 1.12
diff -u -p -r1.12 esp_aesctr.c
--- netinet6/esp_aesctr.c       18 Apr 2009 14:58:05 -0000      1.12
+++ netinet6/esp_aesctr.c       11 Aug 2010 19:54:26 -0000
@@ -79,10 +79,10 @@ esp_aesctr_mature(struct secasvar *sav)
        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));
+                   "%s: unsupported encryption algorithm %d\n",
+                   __func__, sav->alg_enc));
                return 1;
        }
 
Index: netinet6/esp_core.c
===================================================================
RCS file: /cvsroot/src/sys/netinet6/esp_core.c,v
retrieving revision 1.45
diff -u -p -r1.45 esp_core.c
--- netinet6/esp_core.c 18 Apr 2009 14:58:05 -0000      1.45
+++ netinet6/esp_core.c 11 Aug 2010 19:54:27 -0000
@@ -404,9 +404,10 @@ esp_cbc_mature(struct secasvar *sav)
        }
 
        algo = esp_algorithm_lookup(sav->alg_enc);
-       if (!algo) {
+       if (algo == NULL) {
                ipseclog((LOG_ERR,
-                   "esp_cbc_mature %s: unsupported algorithm.\n", algo->name));
+                   "%s: unsupported encryption algorithm %d\n",
+                   __func__, sav->alg_enc));
                return 1;
        }
 


Home | Main Index | Thread Index | Old Index