mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* drivers/hv/hv_common.c:242 hv_kmsg_dump() error: uninitialized symbol 'bytes_written'.
@ 2025-12-17 13:23 Dan Carpenter
  2025-12-19  5:01 ` Michael Kelley
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2025-12-17 13:23 UTC (permalink / raw)
  To: oe-kbuild, Roman Kisel
  Cc: lkp, oe-kbuild-all, linux-kernel, Wei Liu, Michael Kelley

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   ea1013c1539270e372fc99854bc6e4d94eaeff66
commit: f41ceff1748612b9e1538becc13dc2f1617d9d14 Drivers: hv: Enable VTL mode for arm64
date:   7 months ago
config: arm64-randconfig-r072-20251216 (https://download.01.org/0day-ci/archive/20251217/202512172102.OcUspn1Z-lkp@intel.com/config)
compiler: clang version 22.0.0git (https://github.com/llvm/llvm-project 1335a05ab8bc8339ce24be3a9da89d8c3f4e0571)

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>
| Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
| Closes: https://lore.kernel.org/r/202512172102.OcUspn1Z-lkp@intel.com/

smatch warnings:
drivers/hv/hv_common.c:242 hv_kmsg_dump() error: uninitialized symbol 'bytes_written'.

vim +/bytes_written +242 drivers/hv/hv_common.c

9c318a1d9b5000 Long Li         2023-04-20  225  static void hv_kmsg_dump(struct kmsg_dumper *dumper,
e1a261ba599eec Jocelyn Falempe 2024-07-02  226  			 struct kmsg_dump_detail *detail)
9c318a1d9b5000 Long Li         2023-04-20  227  {
9c318a1d9b5000 Long Li         2023-04-20  228  	struct kmsg_dump_iter iter;
9c318a1d9b5000 Long Li         2023-04-20  229  	size_t bytes_written;
9c318a1d9b5000 Long Li         2023-04-20  230  
9c318a1d9b5000 Long Li         2023-04-20  231  	/* We are only interested in panics. */
e1a261ba599eec Jocelyn Falempe 2024-07-02  232  	if (detail->reason != KMSG_DUMP_PANIC || !sysctl_record_panic_msg)
9c318a1d9b5000 Long Li         2023-04-20  233  		return;
9c318a1d9b5000 Long Li         2023-04-20  234  
9c318a1d9b5000 Long Li         2023-04-20  235  	/*
9c318a1d9b5000 Long Li         2023-04-20  236  	 * Write dump contents to the page. No need to synchronize; panic should
9c318a1d9b5000 Long Li         2023-04-20  237  	 * be single-threaded.
9c318a1d9b5000 Long Li         2023-04-20  238  	 */
9c318a1d9b5000 Long Li         2023-04-20  239  	kmsg_dump_rewind(&iter);
9c318a1d9b5000 Long Li         2023-04-20  240  	kmsg_dump_get_buffer(&iter, false, hv_panic_page, HV_HYP_PAGE_SIZE,
9c318a1d9b5000 Long Li         2023-04-20  241  			     &bytes_written);

kmsg_dump_get_buffer() is a no-op if CONFIG_PRINTK is disabled.

9c318a1d9b5000 Long Li         2023-04-20 @242  	if (!bytes_written)
                                                            ^^^^^^^^^^^^^^
uninitialized.

9c318a1d9b5000 Long Li         2023-04-20  243  		return;
9c318a1d9b5000 Long Li         2023-04-20  244  	/*
9c318a1d9b5000 Long Li         2023-04-20  245  	 * P3 to contain the physical address of the panic page & P4 to
9c318a1d9b5000 Long Li         2023-04-20  246  	 * contain the size of the panic data in that page. Rest of the
9c318a1d9b5000 Long Li         2023-04-20  247  	 * registers are no-op when the NOTIFY_MSG flag is set.
9c318a1d9b5000 Long Li         2023-04-20  248  	 */
0e3f7d120086c8 Nuno Das Neves  2024-02-20  249  	hv_set_msr(HV_MSR_CRASH_P0, 0);
0e3f7d120086c8 Nuno Das Neves  2024-02-20  250  	hv_set_msr(HV_MSR_CRASH_P1, 0);
0e3f7d120086c8 Nuno Das Neves  2024-02-20  251  	hv_set_msr(HV_MSR_CRASH_P2, 0);
0e3f7d120086c8 Nuno Das Neves  2024-02-20  252  	hv_set_msr(HV_MSR_CRASH_P3, virt_to_phys(hv_panic_page));
0e3f7d120086c8 Nuno Das Neves  2024-02-20  253  	hv_set_msr(HV_MSR_CRASH_P4, bytes_written);
9c318a1d9b5000 Long Li         2023-04-20  254  
9c318a1d9b5000 Long Li         2023-04-20  255  	/*
9c318a1d9b5000 Long Li         2023-04-20  256  	 * Let Hyper-V know there is crash data available along with
9c318a1d9b5000 Long Li         2023-04-20  257  	 * the panic message.
9c318a1d9b5000 Long Li         2023-04-20  258  	 */
0e3f7d120086c8 Nuno Das Neves  2024-02-20  259  	hv_set_msr(HV_MSR_CRASH_CTL,
9c318a1d9b5000 Long Li         2023-04-20  260  		   (HV_CRASH_CTL_CRASH_NOTIFY |
9c318a1d9b5000 Long Li         2023-04-20  261  		    HV_CRASH_CTL_CRASH_NOTIFY_MSG));
9c318a1d9b5000 Long Li         2023-04-20  262  }

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki


^ permalink raw reply	[flat|nested] 2+ messages in thread

* RE: drivers/hv/hv_common.c:242 hv_kmsg_dump() error: uninitialized symbol 'bytes_written'.
  2025-12-17 13:23 drivers/hv/hv_common.c:242 hv_kmsg_dump() error: uninitialized symbol 'bytes_written' Dan Carpenter
@ 2025-12-19  5:01 ` Michael Kelley
  0 siblings, 0 replies; 2+ messages in thread
From: Michael Kelley @ 2025-12-19  5:01 UTC (permalink / raw)
  To: Dan Carpenter, oe-kbuild; +Cc: lkp, oe-kbuild-all, linux-kernel, Wei Liu

From: Dan Carpenter <dan.carpenter@linaro.org> Sent: Wednesday, December 17, 2025 5:24 AM
> 

I'll submit a patch to fix this.

Michael

> tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
> head:   ea1013c1539270e372fc99854bc6e4d94eaeff66
> commit: f41ceff1748612b9e1538becc13dc2f1617d9d14 Drivers: hv: Enable VTL mode
> for arm64
> date:   7 months ago
> config: arm64-randconfig-r072-20251216 (https://download.01.org/0day-ci/archive/20251217/202512172102.OcUspn1Z-lkp@intel.com/config)
> compiler: clang version 22.0.0git (https://github.com/llvm/llvm-project 1335a05ab8bc8339ce24be3a9da89d8c3f4e0571)
> 
> 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>
> | Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
> | Closes: https://lore.kernel.org/r/202512172102.OcUspn1Z-lkp@intel.com/
> 
> smatch warnings:
> drivers/hv/hv_common.c:242 hv_kmsg_dump() error: uninitialized symbol
> 'bytes_written'.
> 
> vim +/bytes_written +242 drivers/hv/hv_common.c
> 
> 9c318a1d9b5000 Long Li         2023-04-20  225  static void hv_kmsg_dump(struct kmsg_dumper *dumper,
> e1a261ba599eec Jocelyn Falempe 2024-07-02  226  			 struct kmsg_dump_detail *detail)
> 9c318a1d9b5000 Long Li         2023-04-20  227  {
> 9c318a1d9b5000 Long Li         2023-04-20  228  	struct kmsg_dump_iter iter;
> 9c318a1d9b5000 Long Li         2023-04-20  229  	size_t bytes_written;
> 9c318a1d9b5000 Long Li         2023-04-20  230
> 9c318a1d9b5000 Long Li         2023-04-20  231  	/* We are only interested in panics. */
> e1a261ba599eec Jocelyn Falempe 2024-07-02  232  	if (detail->reason != KMSG_DUMP_PANIC || !sysctl_record_panic_msg)
> 9c318a1d9b5000 Long Li         2023-04-20  233  		return;
> 9c318a1d9b5000 Long Li         2023-04-20  234
> 9c318a1d9b5000 Long Li         2023-04-20  235  	/*
> 9c318a1d9b5000 Long Li         2023-04-20  236  	 * Write dump contents to the page. No need to synchronize; panic should
> 9c318a1d9b5000 Long Li         2023-04-20  237  	 * be single-threaded.
> 9c318a1d9b5000 Long Li         2023-04-20  238  	 */
> 9c318a1d9b5000 Long Li         2023-04-20  239  	kmsg_dump_rewind(&iter);
> 9c318a1d9b5000 Long Li         2023-04-20  240  	kmsg_dump_get_buffer(&iter, false, hv_panic_page, HV_HYP_PAGE_SIZE,
> 9c318a1d9b5000 Long Li         2023-04-20  241					 &bytes_written);
> 
> kmsg_dump_get_buffer() is a no-op if CONFIG_PRINTK is disabled.
> 
> 9c318a1d9b5000 Long Li         2023-04-20 @242  	if (!bytes_written)
>                                                             ^^^^^^^^^^^^^^
> uninitialized.
> 
> 9c318a1d9b5000 Long Li         2023-04-20  243  		return;
> 9c318a1d9b5000 Long Li         2023-04-20  244  	/*
> 9c318a1d9b5000 Long Li         2023-04-20  245  	 * P3 to contain the physical address of the panic page & P4 to
> 9c318a1d9b5000 Long Li         2023-04-20  246  	 * contain the size of the panic data in that page. Rest of the
> 9c318a1d9b5000 Long Li         2023-04-20  247  	 * registers are no-op when the NOTIFY_MSG flag is set.
> 9c318a1d9b5000 Long Li         2023-04-20  248  	 */
> 0e3f7d120086c8 Nuno Das Neves  2024-02-20  249 	hv_set_msr(HV_MSR_CRASH_P0, 0);
> 0e3f7d120086c8 Nuno Das Neves  2024-02-20  250 	hv_set_msr(HV_MSR_CRASH_P1, 0);
> 0e3f7d120086c8 Nuno Das Neves  2024-02-20  251 	hv_set_msr(HV_MSR_CRASH_P2, 0);
> 0e3f7d120086c8 Nuno Das Neves  2024-02-20  252 	hv_set_msr(HV_MSR_CRASH_P3, virt_to_phys(hv_panic_page));
> 0e3f7d120086c8 Nuno Das Neves  2024-02-20  253 	hv_set_msr(HV_MSR_CRASH_P4, bytes_written);
> 9c318a1d9b5000 Long Li         2023-04-20  254
> 9c318a1d9b5000 Long Li         2023-04-20  255  	/*
> 9c318a1d9b5000 Long Li         2023-04-20  256  	 * Let Hyper-V know there is crash data available along with
> 9c318a1d9b5000 Long Li         2023-04-20  257  	 * the panic message.
> 9c318a1d9b5000 Long Li         2023-04-20  258  	 */
> 0e3f7d120086c8 Nuno Das Neves  2024-02-20  259 	hv_set_msr(HV_MSR_CRASH_CTL,
> 9c318a1d9b5000 Long Li         2023-04-20  260 			(HV_CRASH_CTL_CRASH_NOTIFY |
> 9c318a1d9b5000 Long Li         2023-04-20  261 			HV_CRASH_CTL_CRASH_NOTIFY_MSG));
> 9c318a1d9b5000 Long Li         2023-04-20  262  }
> 
> --
> 0-DAY CI Kernel Test Service
> https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-12-19  5:01 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-12-17 13:23 drivers/hv/hv_common.c:242 hv_kmsg_dump() error: uninitialized symbol 'bytes_written' Dan Carpenter
2025-12-19  5:01 ` Michael Kelley

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

all inboxes | Powered by JetHome®