All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Chuck Lever <chuck.lever@oracle.com>
Cc: oe-kbuild-all@lists.linux.dev, linux-kernel@vger.kernel.org,
	Simo Sorce <simo@redhat.com>
Subject: net/sunrpc/auth_gss/gss_krb5_mech.c:181 gss_krb5_prepare_enctype_priority_list() warn: unsigned 'i' is never less than zero.
Date: Fri, 30 Jun 2023 22:51:01 +0800	[thread overview]
Message-ID: <202306302221.9wcsHTOG-lkp@intel.com> (raw)

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   e55e5df193d247a38a5e1ac65a5316a0adcc22fa
commit: dfe9a123451a6e73306c988eab3dab12df001677 SUNRPC: Enable rpcsec_gss_krb5.ko to be built without CRYPTO_DES
date:   4 months ago
config: x86_64-randconfig-m001-20230629 (https://download.01.org/0day-ci/archive/20230630/202306302221.9wcsHTOG-lkp@intel.com/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce: (https://download.01.org/0day-ci/archive/20230630/202306302221.9wcsHTOG-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202306302221.9wcsHTOG-lkp@intel.com/

New smatch warnings:
net/sunrpc/auth_gss/gss_krb5_mech.c:181 gss_krb5_prepare_enctype_priority_list() warn: unsigned 'i' is never less than zero.
net/sunrpc/auth_gss/gss_krb5_mech.c:181 gss_krb5_prepare_enctype_priority_list() warn: unsigned 'i' is never less than zero.

Old smatch warnings:
net/sunrpc/auth_gss/gss_krb5_mech.c:200 supported_gss_krb5_enctype() warn: we never enter this loop
net/sunrpc/auth_gss/gss_krb5_mech.c:210 get_gss_krb5_enctype() warn: we never enter this loop

vim +/i +181 net/sunrpc/auth_gss/gss_krb5_mech.c

17781b2ce41a89 Chuck Lever 2023-01-15  159  
17781b2ce41a89 Chuck Lever 2023-01-15  160  static void gss_krb5_prepare_enctype_priority_list(void)
17781b2ce41a89 Chuck Lever 2023-01-15  161  {
17781b2ce41a89 Chuck Lever 2023-01-15  162  	static const u32 gss_krb5_enctypes[] = {
dfe9a123451a6e Chuck Lever 2023-01-15  163  #if defined(CONFIG_RPCSEC_GSS_KRB5_ENCTYPES_AES_SHA1)
17781b2ce41a89 Chuck Lever 2023-01-15  164  		ENCTYPE_AES256_CTS_HMAC_SHA1_96,
17781b2ce41a89 Chuck Lever 2023-01-15  165  		ENCTYPE_AES128_CTS_HMAC_SHA1_96,
dfe9a123451a6e Chuck Lever 2023-01-15  166  #endif
dfe9a123451a6e Chuck Lever 2023-01-15  167  #if defined(CONFIG_RPCSEC_GSS_KRB5_ENCTYPES_DES)
17781b2ce41a89 Chuck Lever 2023-01-15  168  		ENCTYPE_DES3_CBC_SHA1,
17781b2ce41a89 Chuck Lever 2023-01-15  169  		ENCTYPE_DES_CBC_MD5,
17781b2ce41a89 Chuck Lever 2023-01-15  170  		ENCTYPE_DES_CBC_CRC,
17781b2ce41a89 Chuck Lever 2023-01-15  171  		ENCTYPE_DES_CBC_MD4,
17781b2ce41a89 Chuck Lever 2023-01-15  172  #endif
17781b2ce41a89 Chuck Lever 2023-01-15  173  	};
17781b2ce41a89 Chuck Lever 2023-01-15  174  	size_t total, i;
17781b2ce41a89 Chuck Lever 2023-01-15  175  	char buf[16];
17781b2ce41a89 Chuck Lever 2023-01-15  176  	char *sep;
17781b2ce41a89 Chuck Lever 2023-01-15  177  	int n;
17781b2ce41a89 Chuck Lever 2023-01-15  178  
17781b2ce41a89 Chuck Lever 2023-01-15  179  	sep = "";
17781b2ce41a89 Chuck Lever 2023-01-15  180  	gss_krb5_enctype_priority_list[0] = '\0';
17781b2ce41a89 Chuck Lever 2023-01-15 @181  	for (total = 0, i = 0; i < ARRAY_SIZE(gss_krb5_enctypes); i++) {
17781b2ce41a89 Chuck Lever 2023-01-15  182  		n = sprintf(buf, "%s%u", sep, gss_krb5_enctypes[i]);
17781b2ce41a89 Chuck Lever 2023-01-15  183  		if (n < 0)
17781b2ce41a89 Chuck Lever 2023-01-15  184  			break;
17781b2ce41a89 Chuck Lever 2023-01-15  185  		if (total + n >= sizeof(gss_krb5_enctype_priority_list))
17781b2ce41a89 Chuck Lever 2023-01-15  186  			break;
17781b2ce41a89 Chuck Lever 2023-01-15  187  		strcat(gss_krb5_enctype_priority_list, buf);
17781b2ce41a89 Chuck Lever 2023-01-15  188  		sep = ",";
17781b2ce41a89 Chuck Lever 2023-01-15  189  		total += n;
17781b2ce41a89 Chuck Lever 2023-01-15  190  	}
17781b2ce41a89 Chuck Lever 2023-01-15  191  }
17781b2ce41a89 Chuck Lever 2023-01-15  192  

:::::: The code at line 181 was first introduced by commit
:::::: 17781b2ce41a8915163d7cdada021f809ccd49f0 SUNRPC: Replace KRB5_SUPPORTED_ENCTYPES macro

:::::: TO: Chuck Lever <chuck.lever@oracle.com>
:::::: CC: Chuck Lever <chuck.lever@oracle.com>

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

                 reply	other threads:[~2023-06-30 14:51 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202306302221.9wcsHTOG-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=chuck.lever@oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=oe-kbuild-all@lists.linux.dev \
    --cc=simo@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.