lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20200612095845.GE4282@kadam>
Date:   Fri, 12 Jun 2020 12:58:45 +0300
From:   Dan Carpenter <dan.carpenter@...cle.com>
To:     kbuild@...ts.01.org, Harald Freudenberger <freude@...ux.ibm.com>
Cc:     lkp@...el.com, kbuild-all@...ts.01.org,
        linux-kernel@...r.kernel.org, Vasily Gorbik <gor@...ux.ibm.com>
Subject: [kbuild] drivers/s390/crypto/zcrypt_cex4.c:251
 ep11_card_op_modes_show() warn: should '(1 << be a 64 bit

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   b29482fde649c72441d5478a4ea2c52c56d97a5e
commit: a17becc112535b912f2165f80a98c21b59655119 s390/zcrypt: extend EP11 card and queue sysfs attributes
config: s390-randconfig-m031-20200611 (attached as .config)
compiler: s390-linux-gcc (GCC) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@...el.com>
Reported-by: Dan Carpenter <dan.carpenter@...cle.com>

smatch warnings:
drivers/s390/crypto/zcrypt_cex4.c:251 ep11_card_op_modes_show() warn: should '(1 << ep11_op_modes[i]->mode_bit)' be a 64 bit type?
drivers/s390/crypto/zcrypt_cex4.c:346 ep11_queue_op_modes_show() warn: should '(1 << ep11_op_modes[i]->mode_bit)' be a 64 bit type?

# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=a17becc112535b912f2165f80a98c21b59655119
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git remote update linus
git checkout a17becc112535b912f2165f80a98c21b59655119
vim +251 drivers/s390/crypto/zcrypt_cex4.c

a17becc112535b Harald Freudenberger 2019-08-30  237  static ssize_t ep11_card_op_modes_show(struct device *dev,
a17becc112535b Harald Freudenberger 2019-08-30  238  				       struct device_attribute *attr,
a17becc112535b Harald Freudenberger 2019-08-30  239  				       char *buf)
a17becc112535b Harald Freudenberger 2019-08-30  240  {
a17becc112535b Harald Freudenberger 2019-08-30  241  	int i, n = 0;
a17becc112535b Harald Freudenberger 2019-08-30  242  	struct ep11_card_info ci;
a17becc112535b Harald Freudenberger 2019-08-30  243  	struct ap_card *ac = to_ap_card(dev);
a17becc112535b Harald Freudenberger 2019-08-30  244  	struct zcrypt_card *zc = ac->private;
a17becc112535b Harald Freudenberger 2019-08-30  245  
a17becc112535b Harald Freudenberger 2019-08-30  246  	memset(&ci, 0, sizeof(ci));
a17becc112535b Harald Freudenberger 2019-08-30  247  
a17becc112535b Harald Freudenberger 2019-08-30  248  	ep11_get_card_info(ac->id, &ci, zc->online);
a17becc112535b Harald Freudenberger 2019-08-30  249  
a17becc112535b Harald Freudenberger 2019-08-30  250  	for (i = 0; ep11_op_modes[i].mode_txt; i++) {
a17becc112535b Harald Freudenberger 2019-08-30 @251  		if (ci.op_mode & (1 << ep11_op_modes[i].mode_bit)) {
                                                                    ^^^^^^^^^^
This is a u64 type, which suggests that it should be "1ULL << ep11_op_modes[i].mode_bit".

a17becc112535b Harald Freudenberger 2019-08-30  252  			if (n > 0)
a17becc112535b Harald Freudenberger 2019-08-30  253  				buf[n++] = ' ';
a17becc112535b Harald Freudenberger 2019-08-30  254  			n += snprintf(buf + n, PAGE_SIZE - n,
a17becc112535b Harald Freudenberger 2019-08-30  255  				      "%s", ep11_op_modes[i].mode_txt);
a17becc112535b Harald Freudenberger 2019-08-30  256  		}
a17becc112535b Harald Freudenberger 2019-08-30  257  	}
a17becc112535b Harald Freudenberger 2019-08-30  258  	n += snprintf(buf + n, PAGE_SIZE - n, "\n");
a17becc112535b Harald Freudenberger 2019-08-30  259  
a17becc112535b Harald Freudenberger 2019-08-30  260  	return n;
a17becc112535b Harald Freudenberger 2019-08-30  261  }
a17becc112535b Harald Freudenberger 2019-08-30  262  
a17becc112535b Harald Freudenberger 2019-08-30  263  static struct device_attribute dev_attr_ep11_card_op_modes =
a17becc112535b Harald Freudenberger 2019-08-30  264  	__ATTR(op_modes, 0444, ep11_card_op_modes_show, NULL);
a17becc112535b Harald Freudenberger 2019-08-30  265  
a17becc112535b Harald Freudenberger 2019-08-30  266  static struct attribute *ep11_card_attrs[] = {
a17becc112535b Harald Freudenberger 2019-08-30  267  	&dev_attr_ep11_api_ordinalnr.attr,
a17becc112535b Harald Freudenberger 2019-08-30  268  	&dev_attr_ep11_fw_version.attr,
a17becc112535b Harald Freudenberger 2019-08-30  269  	&dev_attr_ep11_serialnr.attr,
a17becc112535b Harald Freudenberger 2019-08-30  270  	&dev_attr_ep11_card_op_modes.attr,
a17becc112535b Harald Freudenberger 2019-08-30  271  	NULL,
a17becc112535b Harald Freudenberger 2019-08-30  272  };
a17becc112535b Harald Freudenberger 2019-08-30  273  
a17becc112535b Harald Freudenberger 2019-08-30  274  static const struct attribute_group ep11_card_attr_grp = {
a17becc112535b Harald Freudenberger 2019-08-30  275  	.attrs = ep11_card_attrs,
a17becc112535b Harald Freudenberger 2019-08-30  276  };
a17becc112535b Harald Freudenberger 2019-08-30  277  
a17becc112535b Harald Freudenberger 2019-08-30  278  /*
a17becc112535b Harald Freudenberger 2019-08-30  279   * EP11 queue additional device attributes
a17becc112535b Harald Freudenberger 2019-08-30  280   */
a17becc112535b Harald Freudenberger 2019-08-30  281  
a17becc112535b Harald Freudenberger 2019-08-30  282  static ssize_t ep11_mkvps_show(struct device *dev,
a17becc112535b Harald Freudenberger 2019-08-30  283  			       struct device_attribute *attr,
a17becc112535b Harald Freudenberger 2019-08-30  284  			       char *buf)
a17becc112535b Harald Freudenberger 2019-08-30  285  {
a17becc112535b Harald Freudenberger 2019-08-30  286  	int n = 0;
a17becc112535b Harald Freudenberger 2019-08-30  287  	struct ep11_domain_info di;
a17becc112535b Harald Freudenberger 2019-08-30  288  	struct zcrypt_queue *zq = to_ap_queue(dev)->private;
a17becc112535b Harald Freudenberger 2019-08-30  289  	static const char * const cwk_state[] = { "invalid", "valid" };
a17becc112535b Harald Freudenberger 2019-08-30  290  	static const char * const nwk_state[] = { "empty", "uncommitted",
a17becc112535b Harald Freudenberger 2019-08-30  291  						  "committed" };
a17becc112535b Harald Freudenberger 2019-08-30  292  
a17becc112535b Harald Freudenberger 2019-08-30  293  	memset(&di, 0, sizeof(di));
a17becc112535b Harald Freudenberger 2019-08-30  294  
a17becc112535b Harald Freudenberger 2019-08-30  295  	if (zq->online)
a17becc112535b Harald Freudenberger 2019-08-30  296  		ep11_get_domain_info(AP_QID_CARD(zq->queue->qid),
a17becc112535b Harald Freudenberger 2019-08-30  297  				     AP_QID_QUEUE(zq->queue->qid),
a17becc112535b Harald Freudenberger 2019-08-30  298  				     &di);
a17becc112535b Harald Freudenberger 2019-08-30  299  
a17becc112535b Harald Freudenberger 2019-08-30  300  	if (di.cur_wk_state == '0') {
a17becc112535b Harald Freudenberger 2019-08-30  301  		n = snprintf(buf, PAGE_SIZE, "WK CUR: %s -\n",
a17becc112535b Harald Freudenberger 2019-08-30  302  			     cwk_state[di.cur_wk_state - '0']);
a17becc112535b Harald Freudenberger 2019-08-30  303  	} else if (di.cur_wk_state == '1') {
a17becc112535b Harald Freudenberger 2019-08-30  304  		n = snprintf(buf, PAGE_SIZE, "WK CUR: %s 0x",
a17becc112535b Harald Freudenberger 2019-08-30  305  			     cwk_state[di.cur_wk_state - '0']);
a17becc112535b Harald Freudenberger 2019-08-30  306  		bin2hex(buf + n, di.cur_wkvp, sizeof(di.cur_wkvp));
a17becc112535b Harald Freudenberger 2019-08-30  307  		n += 2 * sizeof(di.cur_wkvp);
a17becc112535b Harald Freudenberger 2019-08-30  308  		n += snprintf(buf + n, PAGE_SIZE - n, "\n");
a17becc112535b Harald Freudenberger 2019-08-30  309  	} else
a17becc112535b Harald Freudenberger 2019-08-30  310  		n = snprintf(buf, PAGE_SIZE, "WK CUR: - -\n");
a17becc112535b Harald Freudenberger 2019-08-30  311  
a17becc112535b Harald Freudenberger 2019-08-30  312  	if (di.new_wk_state == '0') {
a17becc112535b Harald Freudenberger 2019-08-30  313  		n += snprintf(buf + n, PAGE_SIZE - n, "WK NEW: %s -\n",
a17becc112535b Harald Freudenberger 2019-08-30  314  			      nwk_state[di.new_wk_state - '0']);
a17becc112535b Harald Freudenberger 2019-08-30  315  	} else if (di.new_wk_state >= '1' && di.new_wk_state <= '2') {
a17becc112535b Harald Freudenberger 2019-08-30  316  		n += snprintf(buf + n, PAGE_SIZE - n, "WK NEW: %s 0x",
a17becc112535b Harald Freudenberger 2019-08-30  317  			      nwk_state[di.new_wk_state - '0']);
a17becc112535b Harald Freudenberger 2019-08-30  318  		bin2hex(buf + n, di.new_wkvp, sizeof(di.new_wkvp));
a17becc112535b Harald Freudenberger 2019-08-30  319  		n += 2 * sizeof(di.new_wkvp);
a17becc112535b Harald Freudenberger 2019-08-30  320  		n += snprintf(buf + n, PAGE_SIZE - n, "\n");
a17becc112535b Harald Freudenberger 2019-08-30  321  	} else
a17becc112535b Harald Freudenberger 2019-08-30  322  		n += snprintf(buf + n, PAGE_SIZE - n, "WK NEW: - -\n");
a17becc112535b Harald Freudenberger 2019-08-30  323  
a17becc112535b Harald Freudenberger 2019-08-30  324  	return n;
a17becc112535b Harald Freudenberger 2019-08-30  325  }
a17becc112535b Harald Freudenberger 2019-08-30  326  
a17becc112535b Harald Freudenberger 2019-08-30  327  static struct device_attribute dev_attr_ep11_mkvps =
a17becc112535b Harald Freudenberger 2019-08-30  328  	__ATTR(mkvps, 0444, ep11_mkvps_show, NULL);
a17becc112535b Harald Freudenberger 2019-08-30  329  
a17becc112535b Harald Freudenberger 2019-08-30  330  static ssize_t ep11_queue_op_modes_show(struct device *dev,
a17becc112535b Harald Freudenberger 2019-08-30  331  					struct device_attribute *attr,
a17becc112535b Harald Freudenberger 2019-08-30  332  					char *buf)
a17becc112535b Harald Freudenberger 2019-08-30  333  {
a17becc112535b Harald Freudenberger 2019-08-30  334  	int i, n = 0;
a17becc112535b Harald Freudenberger 2019-08-30  335  	struct ep11_domain_info di;
a17becc112535b Harald Freudenberger 2019-08-30  336  	struct zcrypt_queue *zq = to_ap_queue(dev)->private;
a17becc112535b Harald Freudenberger 2019-08-30  337  
a17becc112535b Harald Freudenberger 2019-08-30  338  	memset(&di, 0, sizeof(di));
a17becc112535b Harald Freudenberger 2019-08-30  339  
a17becc112535b Harald Freudenberger 2019-08-30  340  	if (zq->online)
a17becc112535b Harald Freudenberger 2019-08-30  341  		ep11_get_domain_info(AP_QID_CARD(zq->queue->qid),
a17becc112535b Harald Freudenberger 2019-08-30  342  				     AP_QID_QUEUE(zq->queue->qid),
a17becc112535b Harald Freudenberger 2019-08-30  343  				     &di);
a17becc112535b Harald Freudenberger 2019-08-30  344  
a17becc112535b Harald Freudenberger 2019-08-30  345  	for (i = 0; ep11_op_modes[i].mode_txt; i++) {
a17becc112535b Harald Freudenberger 2019-08-30 @346  		if (di.op_mode & (1 << ep11_op_modes[i].mode_bit)) {
                                                                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Same.

a17becc112535b Harald Freudenberger 2019-08-30  347  			if (n > 0)
a17becc112535b Harald Freudenberger 2019-08-30  348  				buf[n++] = ' ';
a17becc112535b Harald Freudenberger 2019-08-30  349  			n += snprintf(buf + n, PAGE_SIZE - n,
a17becc112535b Harald Freudenberger 2019-08-30  350  				      "%s", ep11_op_modes[i].mode_txt);
a17becc112535b Harald Freudenberger 2019-08-30  351  		}
a17becc112535b Harald Freudenberger 2019-08-30  352  	}
a17becc112535b Harald Freudenberger 2019-08-30  353  	n += snprintf(buf + n, PAGE_SIZE - n, "\n");
a17becc112535b Harald Freudenberger 2019-08-30  354  
a17becc112535b Harald Freudenberger 2019-08-30  355  	return n;
a17becc112535b Harald Freudenberger 2019-08-30  356  }

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

Download attachment ".config.gz" of type "application/gzip" (22854 bytes)

_______________________________________________
kbuild mailing list -- kbuild@...ts.01.org
To unsubscribe send an email to kbuild-leave@...ts.01.org

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ