Author: jhb
Date: Thu Apr  2 17:22:16 2020
New Revision: 359570
URL: https://svnweb.freebsd.org/changeset/base/359570

Log:
  Avoid checking pointers that are never NULL.
  
  Coverity noted that cod pointer is always non-NULL at the end of
  cryptodev_aead().  While here, fix cryptodev_op() to match by making
  one earlier failure case before cod and crp are allocated just return
  directly.
  
  CID:          1422185
  Reported by:  Coverity

Modified:
  head/sys/opencrypto/cryptodev.c

Modified: head/sys/opencrypto/cryptodev.c
==============================================================================
--- head/sys/opencrypto/cryptodev.c     Thu Apr  2 16:55:28 2020        
(r359569)
+++ head/sys/opencrypto/cryptodev.c     Thu Apr  2 17:22:16 2020        
(r359570)
@@ -915,8 +915,7 @@ cryptodev_op(
 
        if (cop->mac && cse->hashsize == 0) {
                SDT_PROBE1(opencrypto, dev, ioctl, error, __LINE__);
-               error = EINVAL;
-               goto bail;
+               return (EINVAL);
        }
 
        /*
@@ -1091,10 +1090,8 @@ again:
        }
 
 bail:
-       if (crp)
-               crypto_freereq(crp);
-       if (cod)
-               cod_free(cod);
+       crypto_freereq(crp);
+       cod_free(cod);
 
        return (error);
 }
@@ -1285,8 +1282,7 @@ again:
 
 bail:
        crypto_freereq(crp);
-       if (cod)
-               cod_free(cod);
+       cod_free(cod);
 
        return (error);
 }
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to