linux/drivers/misc/sgi-xp
Nathan Chancellor b0576f9ecb misc: sgi-xp: Properly initialize buf in xpc_get_rsvd_page_pa
Clang warns:

drivers/misc/sgi-xp/xpc_partition.c:73:14: warning: variable 'buf' is
uninitialized when used within its own initialization [-Wuninitialized]
        void *buf = buf;
              ~~~   ^~~
1 warning generated.

Arnd's explanation during review:

  /*
   * Returns the physical address of the partition's reserved page through
   * an iterative number of calls.
   *
   * On first call, 'cookie' and 'len' should be set to 0, and 'addr'
   * set to the nasid of the partition whose reserved page's address is
   * being sought.
   * On subsequent calls, pass the values, that were passed back on the
   * previous call.
   *
   * While the return status equals SALRET_MORE_PASSES, keep calling
   * this function after first copying 'len' bytes starting at 'addr'
   * into 'buf'. Once the return status equals SALRET_OK, 'addr' will
   * be the physical address of the partition's reserved page. If the
   * return status equals neither of these, an error as occurred.
   */
  static inline s64
  sn_partition_reserved_page_pa(u64 buf, u64 *cookie, u64 *addr, u64 *len)

  so *len is set to zero on the first call and tells the bios how many
  bytes are accessible at 'buf', and it does get updated by the BIOS to
  tell us how many bytes it needs, and then we allocate that and try again.

Fixes: 2792902946 ("[IA64-SGI] cleanup the way XPC locates the reserved page")
Link: https://github.com/ClangBuiltLinux/linux/issues/466
Suggested-by: Stephen Hines <srhines@google.com>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-05-24 19:00:54 +02:00
..
Makefile License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
xp_main.c sgi-xp: Use designated initializers 2017-05-28 10:22:42 -07:00
xp_nofault.S
xp_sn2.c
xp_uv.c
xp.h sgi-xp: Use designated initializers 2017-05-28 10:22:42 -07:00
xpc_channel.c sgi-xp: Replace spin_is_locked() with lockdep 2018-10-15 20:54:17 +02:00
xpc_main.c treewide: kzalloc() -> kcalloc() 2018-06-12 16:19:22 -07:00
xpc_partition.c misc: sgi-xp: Properly initialize buf in xpc_get_rsvd_page_pa 2019-05-24 19:00:54 +02:00
xpc_sn2.c sgi-xp: Replace spin_is_locked() with lockdep 2018-10-15 20:54:17 +02:00
xpc_uv.c sgi-xpc: mark expected switch fall-through 2019-03-28 02:15:51 +09:00
xpc.h
xpnet.c treewide: kzalloc() -> kcalloc() 2018-06-12 16:19:22 -07:00