On Mon, Nov 15, 2021 at 5:00 PM <crash-utility-request@redhat.com> wrote:
Date: Mon, 15 Nov 2021 08:58:56 +0000
From: HAGIO KAZUHITO(?????)     <k-hagio-ab@nec.com>
To: "Discussion list for crash utility usage,   maintenance and
        development"    <crash-utility@redhat.com>
Cc: "atomlin@atomlin.com" <atomlin@atomlin.com>
Subject: Re: [Crash-utility] [PATCH 0/3] Show that the kernel is
        tainted at      init-time
Message-ID:
        <TYYPR01MB6777B57F3C397E7C9F0F7E14DD989@TYYPR01MB6777.jpnprd01.prod.outlook.com>

Content-Type: text/plain; charset="iso-2022-jp"

Hi Aaron,

sorry for the delay.

-----Original Message-----
> The goal of this patchset is to explicitly indicate to the
> user that the Linux kernel is "tainted" at init-time or
> when the 'sys' command is used. In additional to the above
> show_kernel_taints() has been consolidated to avoid
> duplication and hopefully improve readability.

That would be usuful and looks more readable, thanks.

To stop the compilation warning below, with initializing the variables,
Acked-by: Kazuhito Hagio <k-hagio-ab@nec.com>


cc -c -g -DX86_64 -DLZO -DSNAPPY -DZSTD -DGDB_10_2  kernel.c -Wall -O2 -Wstrict-prototypes -Wmissing-prototypes -fstack-protector -Wformat-security
kernel.c: In function ?show_kernel_taints?:
kernel.c:11268:12: warning: ?sp? may be used uninitialized in this function [-Wmaybe-uninitialized]
  tnts_addr = sp->value;
  ~~~~~~~~~~^~~~~~~~~~~
kernel.c:11222:6: warning: ?tnts_len? may be used uninitialized in this function [-Wmaybe-uninitialized]
  int tnts_len;
      ^~~~~~~~

--- a/kernel.c
+++ b/kernel.c
@@ -11219,11 +11219,11 @@ show_kernel_taints(char *buf, int verbose)
        int i, bx;
        uint8_t tnt_bit;
        char tnt_true, tnt_false;
-       int tnts_len;
+       int tnts_len = 0;
        ulong tnts_addr;
        ulong tainted_mask, *tainted_mask_ptr;
        int tainted;
-       struct syment *sp;
+       struct syment *sp = NULL;

        if (kernel_symbol_exists("tainted")) {
                get_symbol_data("tainted", sizeof(int), &tainted);

 
Applied together with the above warning fixes and code indent fixes :
[1] https://github.com/crash-utility/crash/commit/bfa596f40650e5a061b15d41b0a5b108610b11e9
[2] https://github.com/crash-utility/crash/commit/64f48ee6719632895cd8a0922e84a4626e3790d8
[3] https://github.com/crash-utility/crash/commit/b0dd73d2368275e101688b2aca0bc297fd1ba300

Thank you for the patchset, Aaron.

------
ERROR: trailing whitespace
#111: FILE: kernel.c:11233:
+^I} else if (VALID_STRUCT(tnt) || $

ERROR: trailing whitespace
#113: FILE: kernel.c:11235:
+^I^Iif (!VALID_STRUCT(tnt)) { $

ERROR: trailing whitespace
#180: FILE: kernel.c:11278:
+^I^I^I^IKVADDR, &tnt_bit, sizeof(uint8_t), $

ERROR: trailing whitespace
#185: FILE: kernel.c:11283:
+^I^I^I^I^IKVADDR, &tnt_true, sizeof(char), $

ERROR: trailing whitespace
#190: FILE: kernel.c:11288:
+^I^I^I^I^IKVADDR, &tnt_false, sizeof(char), $

total: 5 errors, 0 warnings, 204 lines checked

 

>
>
> Aaron Tomlin (3):
>   kernel: consolidate show_kernel_taints()
>   kernel: Introduce is_kernel_tainted()
>   kernel: show that the kernel is tainted at init-time
>
>  kernel.c | 210 ++++++++++++++++++++++++++-----------------------------
>  1 file changed, 98 insertions(+), 112 deletions(-)
>
> --
> 2.31.1
>