Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 1 Jan 2019 19:56:49 +0000 (UTC)
From:      Conrad Meyer <cem@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r342670 - head/sys/compat/linuxkpi/common/include/linux
Message-ID:  <201901011956.x01JunAj027056@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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);
 }



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201901011956.x01JunAj027056>