lkml.org 
[lkml]   [2020]   [Aug]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    From
    Date
    SubjectRe: [PATCH 3/4] audit: uninitialize static variables
    On Sat, Aug 1, 2020 at 2:46 PM Jules Irenge <jbi.octave@gmail.com> wrote:
    >
    > Checkpatch tool reports an error at variable declaration
    >
    > "ERROR: do not initialise statics to 0"
    >
    > This is due to the fact that these variables are stored in the buffer
    > In the .bss section, one can not set an initial value
    > Here we can trust the compiler to automatically set them to zero.
    > The variable has since been uninitialized.
    >
    > Signed-off-by: Jules Irenge <jbi.octave@gmail.com>
    > ---
    > kernel/audit.c | 8 ++++----
    > 1 file changed, 4 insertions(+), 4 deletions(-)

    In general this is fine, but it will have to wait until after the
    merge window closes.

    > diff --git a/kernel/audit.c b/kernel/audit.c
    > index 7b1a38a211a9..7d79ecb58b01 100644
    > --- a/kernel/audit.c
    > +++ b/kernel/audit.c
    > @@ -311,8 +311,8 @@ void audit_panic(const char *message)
    >
    > static inline int audit_rate_check(void)
    > {
    > - static unsigned long last_check = 0;
    > - static int messages = 0;
    > + static unsigned long last_check;
    > + static int messages;
    > static DEFINE_SPINLOCK(lock);
    > unsigned long flags;
    > unsigned long now;
    > @@ -348,7 +348,7 @@ static inline int audit_rate_check(void)
    > */
    > void audit_log_lost(const char *message)
    > {
    > - static unsigned long last_msg = 0;
    > + static unsigned long last_msg;
    > static DEFINE_SPINLOCK(lock);
    > unsigned long flags;
    > unsigned long now;
    > @@ -713,7 +713,7 @@ static int kauditd_send_queue(struct sock *sk, u32 portid,
    > {
    > int rc = 0;
    > struct sk_buff *skb;
    > - static unsigned int failed = 0;
    > + static unsigned int failed;
    >
    > /* NOTE: kauditd_thread takes care of all our locking, we just use
    > * the netlink info passed to us (e.g. sk and portid) */
    > --
    > 2.26.2

    --
    paul moore
    www.paul-moore.com

    \
     
     \ /
      Last update: 2020-08-01 22:22    [W:3.072 / U:0.008 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site