Re: [PATCH 4/6] tpm: move tpm_validate_commmand() to tpm2-space.c

From: kbuild test robot
Date: Sat Nov 03 2018 - 07:12:36 EST


Hi Jarkko,

I love your patch! Perhaps something to improve:

[auto build test WARNING on jss-tpmdd/next]
[also build test WARNING on next-20181102]
[cannot apply to v4.19]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url: https://github.com/0day-ci/linux/commits/Jarkko-Sakkinen/Detach-TPM-space-code-from-tpm_transmit-flow/20181103-183010
base: git://git.infradead.org/users/jjs/linux-tpmdd next
config: i386-randconfig-x002-201843 (attached as .config)
compiler: gcc-7 (Debian 7.3.0-1) 7.3.0
reproduce:
# save the attached .config to linux build tree
make ARCH=i386

Note: it may well be a FALSE warning. FWIW you are at least aware of it now.
http://gcc.gnu.org/wiki/Better_Uninitialized_Warnings

All warnings (new ones prefixed by >>):

drivers/char/tpm/tpm2-space.c: In function 'tpm2_prepare_space':
>> drivers/char/tpm/tpm2-space.c:335:16: warning: 'cc' may be used uninitialized in this function [-Wmaybe-uninitialized]
chip->last_cc = cc;
~~~~~~~~~~~~~~^~~~

vim +/cc +335 drivers/char/tpm/tpm2-space.c

302
303 int tpm2_prepare_space(struct tpm_chip *chip, struct tpm_space *space, u8 *cmd,
304 size_t cmdsiz)
305 {
306 int rc;
307 int cc;
308
309 if (!space)
310 return 0;
311
312 cc = tpm_validate_command(chip, space, cmd, cmdsiz);
313 if (cc < 0)
314 return cc;
315
316 memcpy(&chip->work_space.context_tbl, &space->context_tbl,
317 sizeof(space->context_tbl));
318 memcpy(&chip->work_space.session_tbl, &space->session_tbl,
319 sizeof(space->session_tbl));
320 memcpy(chip->work_space.context_buf, space->context_buf, PAGE_SIZE);
321 memcpy(chip->work_space.session_buf, space->session_buf, PAGE_SIZE);
322
323 rc = tpm2_load_space(chip);
324 if (rc) {
325 tpm2_flush_space(chip);
326 return rc;
327 }
328
329 rc = tpm2_map_command(chip, cc, cmd);
330 if (rc) {
331 tpm2_flush_space(chip);
332 return rc;
333 }
334
> 335 chip->last_cc = cc;
336 return 0;
337 }
338

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation

Attachment: .config.gz
Description: application/gzip