mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* drivers/crypto/nx/nx-common-pseries.c:1146 nxcop_get_capabilities() error: uninitialized symbol 'hv_nxc'.
@ 2022-06-13 14:33 Dan Carpenter
  0 siblings, 0 replies; only message in thread
From: Dan Carpenter @ 2022-06-13 14:33 UTC (permalink / raw)
  To: kbuild, Haren Myneni; +Cc: lkp, kbuild-all, linux-kernel, Michael Ellerman

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   0678afa6055d14799c1dc1eee47c8025eba56cab
commit: b4ba22114c78de48fda3818f569f75e97d58c719 crypto/nx: Get NX capabilities for GZIP coprocessor type
config: powerpc64-randconfig-m031-20220611 (https://download.01.org/0day-ci/archive/20220612/202206121940.30TYe8Nk-lkp@intel.com/config)
compiler: powerpc64-linux-gcc (GCC) 11.3.0

If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>

smatch warnings:
drivers/crypto/nx/nx-common-pseries.c:1146 nxcop_get_capabilities() error: uninitialized symbol 'hv_nxc'.

vim +/hv_nxc +1146 drivers/crypto/nx/nx-common-pseries.c

b4ba22114c78de4 drivers/crypto/nx/nx-common-pseries.c Haren Myneni  2021-06-17  1098  static void __init nxcop_get_capabilities(void)
b4ba22114c78de4 drivers/crypto/nx/nx-common-pseries.c Haren Myneni  2021-06-17  1099  {
b4ba22114c78de4 drivers/crypto/nx/nx-common-pseries.c Haren Myneni  2021-06-17  1100  	struct hv_vas_all_caps *hv_caps;
b4ba22114c78de4 drivers/crypto/nx/nx-common-pseries.c Haren Myneni  2021-06-17  1101  	struct hv_nx_cop_caps *hv_nxc;
b4ba22114c78de4 drivers/crypto/nx/nx-common-pseries.c Haren Myneni  2021-06-17  1102  	int rc;
b4ba22114c78de4 drivers/crypto/nx/nx-common-pseries.c Haren Myneni  2021-06-17  1103  
b4ba22114c78de4 drivers/crypto/nx/nx-common-pseries.c Haren Myneni  2021-06-17  1104  	hv_caps = kmalloc(sizeof(*hv_caps), GFP_KERNEL);
b4ba22114c78de4 drivers/crypto/nx/nx-common-pseries.c Haren Myneni  2021-06-17  1105  	if (!hv_caps)
b4ba22114c78de4 drivers/crypto/nx/nx-common-pseries.c Haren Myneni  2021-06-17  1106  		return;
b4ba22114c78de4 drivers/crypto/nx/nx-common-pseries.c Haren Myneni  2021-06-17  1107  	/*
b4ba22114c78de4 drivers/crypto/nx/nx-common-pseries.c Haren Myneni  2021-06-17  1108  	 * Get NX overall capabilities with feature type=0
b4ba22114c78de4 drivers/crypto/nx/nx-common-pseries.c Haren Myneni  2021-06-17  1109  	 */
b4ba22114c78de4 drivers/crypto/nx/nx-common-pseries.c Haren Myneni  2021-06-17  1110  	rc = h_query_vas_capabilities(H_QUERY_NX_CAPABILITIES, 0,
b4ba22114c78de4 drivers/crypto/nx/nx-common-pseries.c Haren Myneni  2021-06-17  1111  					  (u64)virt_to_phys(hv_caps));
b4ba22114c78de4 drivers/crypto/nx/nx-common-pseries.c Haren Myneni  2021-06-17  1112  	if (rc)
b4ba22114c78de4 drivers/crypto/nx/nx-common-pseries.c Haren Myneni  2021-06-17  1113  		goto out;
b4ba22114c78de4 drivers/crypto/nx/nx-common-pseries.c Haren Myneni  2021-06-17  1114  
b4ba22114c78de4 drivers/crypto/nx/nx-common-pseries.c Haren Myneni  2021-06-17  1115  	caps_feat = be64_to_cpu(hv_caps->feat_type);
b4ba22114c78de4 drivers/crypto/nx/nx-common-pseries.c Haren Myneni  2021-06-17  1116  	/*
b4ba22114c78de4 drivers/crypto/nx/nx-common-pseries.c Haren Myneni  2021-06-17  1117  	 * NX-GZIP feature available
b4ba22114c78de4 drivers/crypto/nx/nx-common-pseries.c Haren Myneni  2021-06-17  1118  	 */
b4ba22114c78de4 drivers/crypto/nx/nx-common-pseries.c Haren Myneni  2021-06-17  1119  	if (caps_feat & VAS_NX_GZIP_FEAT_BIT) {
b4ba22114c78de4 drivers/crypto/nx/nx-common-pseries.c Haren Myneni  2021-06-17  1120  		hv_nxc = kmalloc(sizeof(*hv_nxc), GFP_KERNEL);
b4ba22114c78de4 drivers/crypto/nx/nx-common-pseries.c Haren Myneni  2021-06-17  1121  		if (!hv_nxc)
b4ba22114c78de4 drivers/crypto/nx/nx-common-pseries.c Haren Myneni  2021-06-17  1122  			goto out;
b4ba22114c78de4 drivers/crypto/nx/nx-common-pseries.c Haren Myneni  2021-06-17  1123  		/*
b4ba22114c78de4 drivers/crypto/nx/nx-common-pseries.c Haren Myneni  2021-06-17  1124  		 * Get capabilities for NX-GZIP feature
b4ba22114c78de4 drivers/crypto/nx/nx-common-pseries.c Haren Myneni  2021-06-17  1125  		 */
b4ba22114c78de4 drivers/crypto/nx/nx-common-pseries.c Haren Myneni  2021-06-17  1126  		rc = h_query_vas_capabilities(H_QUERY_NX_CAPABILITIES,
b4ba22114c78de4 drivers/crypto/nx/nx-common-pseries.c Haren Myneni  2021-06-17  1127  						  VAS_NX_GZIP_FEAT,
b4ba22114c78de4 drivers/crypto/nx/nx-common-pseries.c Haren Myneni  2021-06-17  1128  						  (u64)virt_to_phys(hv_nxc));
b4ba22114c78de4 drivers/crypto/nx/nx-common-pseries.c Haren Myneni  2021-06-17  1129  	} else {
b4ba22114c78de4 drivers/crypto/nx/nx-common-pseries.c Haren Myneni  2021-06-17  1130  		pr_err("NX-GZIP feature is not available\n");
b4ba22114c78de4 drivers/crypto/nx/nx-common-pseries.c Haren Myneni  2021-06-17  1131  		rc = -EINVAL;

hv_nxc is not initialized on this path.

b4ba22114c78de4 drivers/crypto/nx/nx-common-pseries.c Haren Myneni  2021-06-17  1132  	}
b4ba22114c78de4 drivers/crypto/nx/nx-common-pseries.c Haren Myneni  2021-06-17  1133  
b4ba22114c78de4 drivers/crypto/nx/nx-common-pseries.c Haren Myneni  2021-06-17  1134  	if (!rc) {
b4ba22114c78de4 drivers/crypto/nx/nx-common-pseries.c Haren Myneni  2021-06-17  1135  		nx_cop_caps.descriptor = be64_to_cpu(hv_nxc->descriptor);
b4ba22114c78de4 drivers/crypto/nx/nx-common-pseries.c Haren Myneni  2021-06-17  1136  		nx_cop_caps.req_max_processed_len =
b4ba22114c78de4 drivers/crypto/nx/nx-common-pseries.c Haren Myneni  2021-06-17  1137  				be64_to_cpu(hv_nxc->req_max_processed_len);
b4ba22114c78de4 drivers/crypto/nx/nx-common-pseries.c Haren Myneni  2021-06-17  1138  		nx_cop_caps.min_compress_len =
b4ba22114c78de4 drivers/crypto/nx/nx-common-pseries.c Haren Myneni  2021-06-17  1139  				be64_to_cpu(hv_nxc->min_compress_len);
b4ba22114c78de4 drivers/crypto/nx/nx-common-pseries.c Haren Myneni  2021-06-17  1140  		nx_cop_caps.min_decompress_len =
b4ba22114c78de4 drivers/crypto/nx/nx-common-pseries.c Haren Myneni  2021-06-17  1141  				be64_to_cpu(hv_nxc->min_decompress_len);
b4ba22114c78de4 drivers/crypto/nx/nx-common-pseries.c Haren Myneni  2021-06-17  1142  	} else {
b4ba22114c78de4 drivers/crypto/nx/nx-common-pseries.c Haren Myneni  2021-06-17  1143  		caps_feat = 0;
b4ba22114c78de4 drivers/crypto/nx/nx-common-pseries.c Haren Myneni  2021-06-17  1144  	}
b4ba22114c78de4 drivers/crypto/nx/nx-common-pseries.c Haren Myneni  2021-06-17  1145  
b4ba22114c78de4 drivers/crypto/nx/nx-common-pseries.c Haren Myneni  2021-06-17 @1146  	kfree(hv_nxc);
b4ba22114c78de4 drivers/crypto/nx/nx-common-pseries.c Haren Myneni  2021-06-17  1147  out:
b4ba22114c78de4 drivers/crypto/nx/nx-common-pseries.c Haren Myneni  2021-06-17  1148  	kfree(hv_caps);
b4ba22114c78de4 drivers/crypto/nx/nx-common-pseries.c Haren Myneni  2021-06-17  1149  }

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-06-13 16:46 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-13 14:33 drivers/crypto/nx/nx-common-pseries.c:1146 nxcop_get_capabilities() error: uninitialized symbol 'hv_nxc' Dan Carpenter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome