From: kernel test robot <lkp@intel.com>
To: Danielle Ratson <danieller@nvidia.com>
Cc: llvm@lists.linux.dev, oe-kbuild-all@lists.linux.dev,
Petr Machata <petrm@nvidia.com>
Subject: [jpirko-mlxsw:combined_queue 23/39] net/ethtool/cmis_cdb.c:574:40: warning: variable 'bytes_written' is uninitialized when used here
Date: Sun, 8 Sep 2024 07:01:13 +0800 [thread overview]
Message-ID: <202409080656.dUNiF2ts-lkp@intel.com> (raw)
tree: https://github.com/jpirko/linux_mlxsw combined_queue
head: 1e442c563723a4ecdef463c14b10ba919b27acdf
commit: 74c5ee4c97461509353a6a12028906809fe2c208 [23/39] net: ethtool: Add support for writing firmware blocks using EPL payload
config: x86_64-rhel-8.3-rust (https://download.01.org/0day-ci/archive/20240908/202409080656.dUNiF2ts-lkp@intel.com/config)
compiler: clang version 18.1.5 (https://github.com/llvm/llvm-project 617a15a9eac96088ae5e9134248d8236e34b91b1)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240908/202409080656.dUNiF2ts-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/202409080656.dUNiF2ts-lkp@intel.com/
All warnings (new ones prefixed by >>):
>> net/ethtool/cmis_cdb.c:574:40: warning: variable 'bytes_written' is uninitialized when used here [-Wuninitialized]
574 | page <= CMIS_CDB_EPL_PAGE_END && bytes_written < epl_len; page++) {
| ^~~~~~~~~~~~~
net/ethtool/cmis_cdb.c:569:19: note: initialize the variable 'bytes_written' to silence this warning
569 | u32 bytes_written;
| ^
| = 0
1 warning generated.
vim +/bytes_written +574 net/ethtool/cmis_cdb.c
562
563 static int
564 ethtool_cmis_cdb_execute_epl_cmd(struct net_device *dev,
565 struct ethtool_cmis_cdb_cmd_args *args,
566 struct ethtool_module_eeprom *page_data)
567 {
568 u16 epl_len = be16_to_cpu(args->req.epl_len);
569 u32 bytes_written;
570 u8 page;
571 int err;
572
573 for (page = CMIS_CDB_EPL_PAGE_START;
> 574 page <= CMIS_CDB_EPL_PAGE_END && bytes_written < epl_len; page++) {
575 u16 offset = CMIS_CDB_EPL_FW_BLOCK_OFFSET_START;
576
577 while (offset <= CMIS_CDB_EPL_FW_BLOCK_OFFSET_END &&
578 bytes_written < epl_len) {
579 u32 bytes_left = epl_len - bytes_written;
580 u16 space_left, bytes_to_write;
581
582 space_left = CMIS_CDB_EPL_FW_BLOCK_OFFSET_END - offset + 1;
583 bytes_to_write = min_t(u16, bytes_left,
584 min_t(u16, space_left,
585 args->read_write_len_ext));
586
587 err = __ethtool_cmis_cdb_execute_cmd(dev, page_data,
588 page, offset,
589 bytes_to_write,
590 args->req.epl + bytes_written);
591 if (err < 0)
592 return err;
593
594 offset += bytes_to_write;
595 bytes_written += bytes_to_write;
596 }
597 }
598 return 0;
599 }
600
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
reply other threads:[~2024-09-07 23:01 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=202409080656.dUNiF2ts-lkp@intel.com \
--to=lkp@intel.com \
--cc=danieller@nvidia.com \
--cc=llvm@lists.linux.dev \
--cc=oe-kbuild-all@lists.linux.dev \
--cc=petrm@nvidia.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.