All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: kbuild@lists.01.org
Subject: drivers/ata/libata-acpi.c:768:19: warning: Value stored to 'ap' during its initialization is never read [clang-analyzer-deadcode.DeadStores]
Date: Wed, 26 Jan 2022 13:37:07 +0800	[thread overview]
Message-ID: <202201261355.9OWahdki-lkp@intel.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 18818 bytes --]

CC: llvm(a)lists.linux.dev
CC: kbuild-all(a)lists.01.org
CC: linux-kernel(a)vger.kernel.org
TO: Hannes Reinecke <hare@suse.de>
CC: Damien Le Moal <damien.lemoal@opensource.wdc.com>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   0280e3c58f92b2fe0e8fbbdf8d386449168de4a8
commit: 17a1e1be2fc7dc99945b41df0485037dcb6044d0 ata: libata: drop ata_msg_probe()
date:   3 weeks ago
:::::: branch date: 11 hours ago
:::::: commit date: 3 weeks ago
config: x86_64-randconfig-c007-20220124 (https://download.01.org/0day-ci/archive/20220126/202201261355.9OWahdki-lkp(a)intel.com/config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 7b3d30728816403d1fd73cc5082e9fb761262bce)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=17a1e1be2fc7dc99945b41df0485037dcb6044d0
        git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
        git fetch --no-tags linus master
        git checkout 17a1e1be2fc7dc99945b41df0485037dcb6044d0
        # save the config file to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64 clang-analyzer 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>


clang-analyzer warnings: (new ones prefixed by >>)
   include/asm-generic/rwonce.h:36:2: note: expanded from macro 'compiletime_assert_rwonce_type'
           compiletime_assert(__native_word(t) || sizeof(t) == sizeof(long long),  \
           ^
   include/linux/compiler_types.h:335:2: note: expanded from macro 'compiletime_assert'
           _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
           ^
   include/linux/compiler_types.h:323:2: note: expanded from macro '_compiletime_assert'
           __compiletime_assert(condition, msg, prefix, suffix)
           ^
   include/linux/compiler_types.h:307:2: note: expanded from macro '__compiletime_assert'
           do {                                                            \
           ^
   include/linux/skbuff.h:2136:2: note: Dereference of null pointer
           WRITE_ONCE(next->prev, prev);
           ^
   include/asm-generic/rwonce.h:61:2: note: expanded from macro 'WRITE_ONCE'
           __WRITE_ONCE(x, val);                                           \
           ^~~~~~~~~~~~~~~~~~~~
   include/asm-generic/rwonce.h:55:30: note: expanded from macro '__WRITE_ONCE'
           *(volatile typeof(x) *)&(x) = (val);                            \
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
   net/ipv6/ip6_output.c:233:7: warning: Access to field 'autoflowlabel_set' results in a dereference of a null pointer (loaded from variable 'np') [clang-analyzer-core.NullDereference]
           if (!np->autoflowlabel_set)
                ^
   net/ipv6/ip6_output.c:249:32: note: Calling 'inet6_sk'
           const struct ipv6_pinfo *np = inet6_sk(sk);
                                         ^~~~~~~~~~~~
   include/linux/ipv6.h:332:9: note: Assuming the condition is true
           return sk_fullsock(__sk) ? inet_sk(__sk)->pinet6 : NULL;
                  ^~~~~~~~~~~~~~~~~
   include/linux/ipv6.h:332:9: note: '?' condition is true
   include/linux/ipv6.h:332:2: note: Returning pointer
           return sk_fullsock(__sk) ? inet_sk(__sk)->pinet6 : NULL;
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   net/ipv6/ip6_output.c:249:32: note: Returning from 'inet6_sk'
           const struct ipv6_pinfo *np = inet6_sk(sk);
                                         ^~~~~~~~~~~~
   net/ipv6/ip6_output.c:249:2: note: 'np' initialized here
           const struct ipv6_pinfo *np = inet6_sk(sk);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~
   net/ipv6/ip6_output.c:262:6: note: Assuming 'opt' is null
           if (opt)
               ^~~
   net/ipv6/ip6_output.c:262:2: note: Taking false branch
           if (opt)
           ^
   net/ipv6/ip6_output.c:265:15: note: Assuming the condition is false
           if (unlikely(head_room > skb_headroom(skb))) {
                        ^
   include/linux/compiler.h:78:42: note: expanded from macro 'unlikely'
   # define unlikely(x)    __builtin_expect(!!(x), 0)
                                               ^
   net/ipv6/ip6_output.c:265:2: note: Taking false branch
           if (unlikely(head_room > skb_headroom(skb))) {
           ^
   net/ipv6/ip6_output.c:273:6: note: 'opt' is null
           if (opt) {
               ^~~
   net/ipv6/ip6_output.c:273:2: note: Taking false branch
           if (opt) {
           ^
   net/ipv6/ip6_output.c:291:6: note: Assuming 'np' is null
           if (np)
               ^~
   net/ipv6/ip6_output.c:291:2: note: Taking false branch
           if (np)
           ^
   net/ipv6/ip6_output.c:293:6: note: 'hlimit' is < 0
           if (hlimit < 0)
               ^~~~~~
   net/ipv6/ip6_output.c:293:2: note: Taking true branch
           if (hlimit < 0)
           ^
   net/ipv6/ip6_output.c:297:28: note: Passing null pointer value via 2nd parameter 'np'
                                   ip6_autoflowlabel(net, np), fl6));
                                                          ^~
   net/ipv6/ip6_output.c:297:5: note: Calling 'ip6_autoflowlabel'
                                   ip6_autoflowlabel(net, np), fl6));
                                   ^~~~~~~~~~~~~~~~~~~~~~~~~~
   net/ipv6/ip6_output.c:233:7: note: Access to field 'autoflowlabel_set' results in a dereference of a null pointer (loaded from variable 'np')
           if (!np->autoflowlabel_set)
                ^~
   Suppressed 1 warnings (1 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   5 warnings generated.
   Suppressed 5 warnings (5 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   5 warnings generated.
   Suppressed 5 warnings (5 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   5 warnings generated.
   Suppressed 5 warnings (5 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   5 warnings generated.
   Suppressed 5 warnings (5 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   5 warnings generated.
   Suppressed 5 warnings (5 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   6 warnings generated.
>> drivers/ata/libata-acpi.c:768:19: warning: Value stored to 'ap' during its initialization is never read [clang-analyzer-deadcode.DeadStores]
           struct ata_port *ap = dev->link->ap;
                            ^~   ~~~~~~~~~~~~~
   drivers/ata/libata-acpi.c:768:19: note: Value stored to 'ap' during its initialization is never read
           struct ata_port *ap = dev->link->ap;
                            ^~   ~~~~~~~~~~~~~
   Suppressed 5 warnings (5 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   1 warning generated.
   Suppressed 1 warnings (1 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   2 warnings generated.
   drivers/hwmon/adm1031.c:245:6: warning: Value stored to 'range' during its initialization is never read [clang-analyzer-deadcode.DeadStores]
           int range = val - AUTO_TEMP_MIN_FROM_REG(reg);
               ^~~~~   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/hwmon/adm1031.c:245:6: note: Value stored to 'range' during its initialization is never read
           int range = val - AUTO_TEMP_MIN_FROM_REG(reg);
               ^~~~~   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   Suppressed 1 warnings (1 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   1 warning generated.
   Suppressed 1 warnings (1 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   1 warning generated.
   Suppressed 1 warnings (1 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   1 warning generated.
   Suppressed 1 warnings (1 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   1 warning generated.
   Suppressed 1 warnings (1 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   2 warnings generated.
   Suppressed 2 warnings (1 in non-user code, 1 with check filters).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   1 warning generated.
   Suppressed 1 warnings (1 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   1 warning generated.
   Suppressed 1 warnings (1 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   1 warning generated.
   Suppressed 1 warnings (1 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   1 warning generated.
   Suppressed 1 warnings (1 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   4 warnings generated.
   net/ipv4/route.c:568:7: warning: Dereference of null pointer [clang-analyzer-core.NullDereference]
           rt = rcu_dereference(fnhe->fnhe_rth_input);
                ^
   include/linux/rcupdate.h:597:28: note: expanded from macro 'rcu_dereference'
   #define rcu_dereference(p) rcu_dereference_check(p, 0)
                              ^
   include/linux/rcupdate.h:529:2: note: expanded from macro 'rcu_dereference_check'
           __rcu_dereference_check((p), (c) || rcu_read_lock_held(), __rcu)
           ^
   include/linux/rcupdate.h:390:48: note: expanded from macro '__rcu_dereference_check'
           typeof(*p) *________p1 = (typeof(*p) *__force)READ_ONCE(p); \
                                                         ^
   include/asm-generic/rwonce.h:50:2: note: expanded from macro 'READ_ONCE'
           __READ_ONCE(x);                                                 \
           ^
   include/asm-generic/rwonce.h:44:24: note: expanded from macro '__READ_ONCE'
   #define __READ_ONCE(x)  (*(const volatile __unqual_scalar_typeof(x) *)&(x))
                           ^
   net/ipv4/route.c:585:34: note: 'oldest' initialized to a null pointer value
           struct fib_nh_exception *fnhe, *oldest = NULL;
                                           ^~~~~~
   net/ipv4/route.c:587:2: note: Loop condition is true.  Entering loop body
           for (fnhe_p = &hash->chain; ; fnhe_p = &fnhe->fnhe_next) {
           ^
   net/ipv4/route.c:588:10: note: Assuming the condition is false
                   fnhe = rcu_dereference_protected(*fnhe_p,
                          ^
   include/linux/rcupdate.h:588:2: note: expanded from macro 'rcu_dereference_protected'
           __rcu_dereference_protected((p), (c), __rcu)
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/rcupdate.h:397:19: note: expanded from macro '__rcu_dereference_protected'
           RCU_LOCKDEP_WARN(!(c), "suspicious rcu_dereference_protected() usage"); \
           ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/rcupdate.h:319:8: note: expanded from macro 'RCU_LOCKDEP_WARN'
                   if ((c) && debug_lockdep_rcu_enabled() && !__warned) {  \
                        ^
   net/ipv4/route.c:588:10: note: Left side of '&&' is false
                   fnhe = rcu_dereference_protected(*fnhe_p,
                          ^
   include/linux/rcupdate.h:588:2: note: expanded from macro 'rcu_dereference_protected'
           __rcu_dereference_protected((p), (c), __rcu)
           ^
   include/linux/rcupdate.h:397:2: note: expanded from macro '__rcu_dereference_protected'
           RCU_LOCKDEP_WARN(!(c), "suspicious rcu_dereference_protected() usage"); \
           ^
   include/linux/rcupdate.h:319:11: note: expanded from macro 'RCU_LOCKDEP_WARN'
                   if ((c) && debug_lockdep_rcu_enabled() && !__warned) {  \
                           ^
   net/ipv4/route.c:588:10: note: Loop condition is false.  Exiting loop
                   fnhe = rcu_dereference_protected(*fnhe_p,
                          ^
   include/linux/rcupdate.h:588:2: note: expanded from macro 'rcu_dereference_protected'
           __rcu_dereference_protected((p), (c), __rcu)

vim +/ap +768 drivers/ata/libata-acpi.c

11ef697b37e3c8 Kristen Carlson Accardi 2006-09-28  749  
7ea1fbc2a2449b Kristen Carlson Accardi 2006-09-28  750  /**
7ea1fbc2a2449b Kristen Carlson Accardi 2006-09-28  751   * ata_acpi_push_id - send Identify data to drive
3a32a8e96694a2 Tejun Heo               2007-05-05  752   * @dev: target ATA device
7ea1fbc2a2449b Kristen Carlson Accardi 2006-09-28  753   *
7ea1fbc2a2449b Kristen Carlson Accardi 2006-09-28  754   * _SDD ACPI object: for SATA mode only
7ea1fbc2a2449b Kristen Carlson Accardi 2006-09-28  755   * Must be after Identify (Packet) Device -- uses its data
7ea1fbc2a2449b Kristen Carlson Accardi 2006-09-28  756   * ATM this function never returns a failure.  It is an optional
7ea1fbc2a2449b Kristen Carlson Accardi 2006-09-28  757   * method and if it fails for whatever reason, we should still
7ea1fbc2a2449b Kristen Carlson Accardi 2006-09-28  758   * just keep going.
69b16a5f4c4f1d Tejun Heo               2007-05-15  759   *
69b16a5f4c4f1d Tejun Heo               2007-05-15  760   * LOCKING:
69b16a5f4c4f1d Tejun Heo               2007-05-15  761   * EH context.
69b16a5f4c4f1d Tejun Heo               2007-05-15  762   *
69b16a5f4c4f1d Tejun Heo               2007-05-15  763   * RETURNS:
f2406770a2f62a Tejun Heo               2009-11-18  764   * 0 on success, -ENOENT if _SDD doesn't exist, -errno on failure.
7ea1fbc2a2449b Kristen Carlson Accardi 2006-09-28  765   */
6746544c3b143c Tejun Heo               2007-05-15  766  static int ata_acpi_push_id(struct ata_device *dev)
7ea1fbc2a2449b Kristen Carlson Accardi 2006-09-28  767  {
9af5c9c97dc9d5 Tejun Heo               2007-08-06 @768  	struct ata_port *ap = dev->link->ap;
7ea1fbc2a2449b Kristen Carlson Accardi 2006-09-28  769  	acpi_status status;
7ea1fbc2a2449b Kristen Carlson Accardi 2006-09-28  770  	struct acpi_object_list input;
7ea1fbc2a2449b Kristen Carlson Accardi 2006-09-28  771  	union acpi_object in_params[1];
7ea1fbc2a2449b Kristen Carlson Accardi 2006-09-28  772  
a9a79dfec23956 Joe Perches             2011-04-15  773  	ata_dev_dbg(dev, "%s: ix = %d, port#: %d\n",
7f5e4e8d94b601 Harvey Harrison         2008-03-05  774  		    __func__, dev->devno, ap->port_no);
7ea1fbc2a2449b Kristen Carlson Accardi 2006-09-28  775  
7ea1fbc2a2449b Kristen Carlson Accardi 2006-09-28  776  	/* Give the drive Identify data to the drive via the _SDD method */
7ea1fbc2a2449b Kristen Carlson Accardi 2006-09-28  777  	/* _SDD: set up input parameters */
7ea1fbc2a2449b Kristen Carlson Accardi 2006-09-28  778  	input.count = 1;
7ea1fbc2a2449b Kristen Carlson Accardi 2006-09-28  779  	input.pointer = in_params;
7ea1fbc2a2449b Kristen Carlson Accardi 2006-09-28  780  	in_params[0].type = ACPI_TYPE_BUFFER;
3a32a8e96694a2 Tejun Heo               2007-05-05  781  	in_params[0].buffer.length = sizeof(dev->id[0]) * ATA_ID_WORDS;
3a32a8e96694a2 Tejun Heo               2007-05-05  782  	in_params[0].buffer.pointer = (u8 *)dev->id;
7ea1fbc2a2449b Kristen Carlson Accardi 2006-09-28  783  	/* Output buffer: _SDD has no output */
7ea1fbc2a2449b Kristen Carlson Accardi 2006-09-28  784  
7ea1fbc2a2449b Kristen Carlson Accardi 2006-09-28  785  	/* It's OK for _SDD to be missing too. */
3a32a8e96694a2 Tejun Heo               2007-05-05  786  	swap_buf_le16(dev->id, ATA_ID_WORDS);
30dcf76acc695c Matthew Garrett         2012-06-25  787  	status = acpi_evaluate_object(ata_dev_acpi_handle(dev), "_SDD", &input,
30dcf76acc695c Matthew Garrett         2012-06-25  788  				      NULL);
3a32a8e96694a2 Tejun Heo               2007-05-05  789  	swap_buf_le16(dev->id, ATA_ID_WORDS);
7ea1fbc2a2449b Kristen Carlson Accardi 2006-09-28  790  
f2406770a2f62a Tejun Heo               2009-11-18  791  	if (status == AE_NOT_FOUND)
f2406770a2f62a Tejun Heo               2009-11-18  792  		return -ENOENT;
f2406770a2f62a Tejun Heo               2009-11-18  793  
f2406770a2f62a Tejun Heo               2009-11-18  794  	if (ACPI_FAILURE(status)) {
a9a79dfec23956 Joe Perches             2011-04-15  795  		ata_dev_warn(dev, "ACPI _SDD failed (AE 0x%x)\n", status);
f2406770a2f62a Tejun Heo               2009-11-18  796  		return -EIO;
f2406770a2f62a Tejun Heo               2009-11-18  797  	}
7ea1fbc2a2449b Kristen Carlson Accardi 2006-09-28  798  
f2406770a2f62a Tejun Heo               2009-11-18  799  	return 0;
6746544c3b143c Tejun Heo               2007-05-15  800  }
6746544c3b143c Tejun Heo               2007-05-15  801  

:::::: The code at line 768 was first introduced by commit
:::::: 9af5c9c97dc9d599281778864c72b385f0c63341 libata-link: introduce ata_link

:::::: TO: Tejun Heo <htejun@gmail.com>
:::::: CC: Jeff Garzik <jeff@garzik.org>

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

                 reply	other threads:[~2022-01-26  5:37 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=202201261355.9OWahdki-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=kbuild@lists.01.org \
    /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.