svn commit: r342670 - head/sys/compat/linuxkpi/common/include/linux

Conrad Meyer cem at FreeBSD.org
Tue Jan 1 19:56:50 UTC 2019


Author: cem
Date: Tue Jan  1 19:56:49 2019
New Revision: 342670
URL: https://svnweb.freebsd.org/changeset/base/342670

Log:
  linuxkpi: Remove extraneous NULL check on M_WAITOK allocation
  
  The check was not introduced in r342628, but the subsequent unchecked access to
  refs was added then, prompting a Coverity warning about "Null pointer
  dereferences (FORWARD_NULL)."  The warning is bogus due to M_WAITOK, but so is
  the NULL check that hints it, so just remove it.
  
  CID:		1398588
  Reported by:	Coverity

Modified:
  head/sys/compat/linuxkpi/common/include/linux/cdev.h

Modified: head/sys/compat/linuxkpi/common/include/linux/cdev.h
==============================================================================
--- head/sys/compat/linuxkpi/common/include/linux/cdev.h	Tue Jan  1 10:05:36 2019	(r342669)
+++ head/sys/compat/linuxkpi/common/include/linux/cdev.h	Tue Jan  1 19:56:49 2019	(r342670)
@@ -71,8 +71,7 @@ cdev_alloc(void)
 	struct linux_cdev *cdev;
 
 	cdev = kzalloc(sizeof(struct linux_cdev), M_WAITOK);
-	if (cdev != NULL)
-		kobject_init(&cdev->kobj, &linux_cdev_ktype);
+	kobject_init(&cdev->kobj, &linux_cdev_ktype);
 	cdev->refs = 1;
 	return (cdev);
 }


More information about the svn-src-head mailing list