Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 5 Sep 2019 17:20:49 +0000 (UTC)
From:      Ian Lepore <ian@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org
Subject:   svn commit: r351877 - stable/12/sys/fs/nandfs
Message-ID:  <201909051720.x85HKnId013182@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: ian
Date: Thu Sep  5 17:20:48 2019
New Revision: 351877
URL: https://svnweb.freebsd.org/changeset/base/351877

Log:
  Fix LINT kernel builds on powerpc64 and sparc64.  This is a direct commit
  to 12-stable because the nandfs code no longer exists in 13-current.
  
  The build was failing with
  
   nandfs_dat.c:301:
    warning: comparison is always false due to limited range of data type
  
  I tried to fix it with an inline (size_t) cast of nargv->nv_nmembs in the
  if() expression, but that didn't help (which seems a bit buggy), but using
  an intermediate variable fixed it.  Elegance doesn't matter as much as
  suppressing the warning; this code is long-dead even on this branch.

Modified:
  stable/12/sys/fs/nandfs/nandfs_dat.c

Modified: stable/12/sys/fs/nandfs/nandfs_dat.c
==============================================================================
--- stable/12/sys/fs/nandfs/nandfs_dat.c	Thu Sep  5 17:20:24 2019	(r351876)
+++ stable/12/sys/fs/nandfs/nandfs_dat.c	Thu Sep  5 17:20:48 2019	(r351877)
@@ -295,10 +295,11 @@ nandfs_get_dat_bdescs_ioctl(struct nandfs_device *nffs
     struct nandfs_argv *nargv)
 {
 	struct nandfs_bdesc *bd;
-	size_t size;
+	size_t size, sizecheck;
 	int error;
 
-	if (nargv->nv_nmembs >= SIZE_MAX / sizeof(struct nandfs_bdesc))
+	sizecheck = nargv->nv_nmembs;
+	if (sizecheck >= SIZE_MAX / sizeof(struct nandfs_bdesc))
 		return (EINVAL);
 		
 	size = nargv->nv_nmembs * sizeof(struct nandfs_bdesc);



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