Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp961156pxa; Sat, 1 Aug 2020 11:47:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw95ck8bScKTXUekyBV56xI64aMdncHvbM8Sxo0D1jRGcjajEa/8M30s/oAZzb+/cGKtmyd X-Received: by 2002:a50:d1c2:: with SMTP id i2mr8920595edg.60.1596307664712; Sat, 01 Aug 2020 11:47:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596307664; cv=none; d=google.com; s=arc-20160816; b=XIwyM78F/d37V009PQTC0rs2TGEjLIDqd/QQ/IcNcfD9ysFQMj0SRktti96pnbquXt 1DjRLnI9FtVILYCuHFDLqSQUG/cjDCcwkQj59o1JPz81ILd8bKHuDK4ODt11qpjHu0w6 HBq6mqY+Yqf4nwV8Z9eOO5uVnE9XPBIocnq/1N68UATrHnRBOhnKjCE3ytcTcZtChaDO KOYjmFNGmySAj8C2C3LTGdNRqk/2jZzax19xge3u9WlwTXzx3Rs22cjDoNK/tE/uVyT1 ZbNhTREdwCby3kheL0YeipZJSTFWI34bA5qkc7syRCbjofAN6t3Dx3BxViHjFVECFUuf 29KQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=DoAzX0mPxKwifGhIAYoV8gWIU4fgddXvYUu1szasbME=; b=HvCw0NUjfEZ2zeWtlHcAweq/erLnuQ3uhk8NA1FgstMajdJlhi6Wqt3dvSYRNOi5D0 8Z03H7H7pXHvPAwwn4Zt5RnNPeKqI7pS65CRDmPnRvL136p1tyJmbTFokpNfOVEXkGdR oseSXLOWQI5Dx5L9I2MDhOgjiTEWah97dX4+C9TL92FwOCZe0wprE021G99nTcklaeok TM+O5EEczei3Qxyt9g4yWGbSfX0mJ2fD4eRKXUQh5VDG54OJ3+VfAwQk96Eg3XFgyWeN 1v5dYxXLYFSIgzk2XgFZjHWj8KN5IlKG/y2tlWgdPMfPGjunku7I+XZLBEvi9BBjmldM 8ezQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=TiffGE6F; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d8si5281302edq.177.2020.08.01.11.46.50; Sat, 01 Aug 2020 11:47:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=TiffGE6F; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727775AbgHASql (ORCPT + 99 others); Sat, 1 Aug 2020 14:46:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55954 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727063AbgHASqj (ORCPT ); Sat, 1 Aug 2020 14:46:39 -0400 Received: from mail-wr1-x443.google.com (mail-wr1-x443.google.com [IPv6:2a00:1450:4864:20::443]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5887CC06174A for ; Sat, 1 Aug 2020 11:46:39 -0700 (PDT) Received: by mail-wr1-x443.google.com with SMTP id r4so27736034wrx.9 for ; Sat, 01 Aug 2020 11:46:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=DoAzX0mPxKwifGhIAYoV8gWIU4fgddXvYUu1szasbME=; b=TiffGE6FOY11z2ZpFyKJWmRbhR+8VYGGHcuUJ2pDvXdKyRco3smaDAN7F/caupCQkc k0m9zesmoKK6rIZxl3Wb0XqfTX+PQsj659jowXgbnzebu+f8IsBf9k5L1UdJwQPeZxGu +ZCS42FWf+6muHgIkq6eqFNCs9DCLOPYyqeHoNk6eFXcu/qaWEGLPKZz6h/Gve16PF54 n+g9l3zUSyLvOKoD6rDdpvCWylCe4ECJBVqIHOqM+u1I4/ik/JriIKDPI8yOh8ByrQeh 8pgk6GZMuVYk0hh7I3y8XmcixdNLD9H0pmvdJcQ2TFip4b1QW5NJLipU9MN+gABvrTTn GaGg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=DoAzX0mPxKwifGhIAYoV8gWIU4fgddXvYUu1szasbME=; b=RRX+/DStpc4M/74hp4sZP6OyQYjsGbWMddLz5orfEcxrV8DsLaEnW+D93MKrdW9oZH Mtvvs2+Nvhrs9nXbO2fS4btTI3OXo1tN4p+6W+t6T81TDXVNOxt0IA/VfAI4F6YGOzln bz8RbBwnTH9TV+oWzxONEvCFjemFv2ovst+2U+E+6WhulD+ADrnAmxSz+VkyqDVssWP9 4RInPlYZ0Lqd34vwoP/yTFt16FJDkB+wZahtBwCq+v0xIAB0poeyXkttU7EQ8oi0e/tv 1IGIkfE7KX8aIpbZvmg6Q6DZkjPgpKUZV00UGF3Bs9rBgIDGlGV9tuQ6vO7jSQdOoSDd QERQ== X-Gm-Message-State: AOAM53219I+x8DqSFFomVyM3demxr1KmcjhZoZ8TZLZlMq5jxQu8yviB X4ejak4rliFJOm2C5D0lp8kmPlSUd5De X-Received: by 2002:a5d:438c:: with SMTP id i12mr8998288wrq.210.1596307597696; Sat, 01 Aug 2020 11:46:37 -0700 (PDT) Received: from localhost.lan (host-92-25-238-49.as13285.net. [92.25.238.49]) by smtp.gmail.com with ESMTPSA id g7sm17468447wrv.82.2020.08.01.11.46.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 01 Aug 2020 11:46:37 -0700 (PDT) From: Jules Irenge To: linux-kernel@vger.kernel.org Cc: Jules Irenge , Paul Moore , Eric Paris , linux-audit@redhat.com (moderated list:AUDIT SUBSYSTEM) Subject: [PATCH 3/4] audit: uninitialize static variables Date: Sat, 1 Aug 2020 19:46:02 +0100 Message-Id: <20200801184603.310769-4-jbi.octave@gmail.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200801184603.310769-1-jbi.octave@gmail.com> References: <0/4> <20200801184603.310769-1-jbi.octave@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- kernel/audit.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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