From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DF674C433F5 for ; Sun, 15 May 2022 07:31:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235061AbiEOHbl (ORCPT ); Sun, 15 May 2022 03:31:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40746 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229709AbiEOHbi (ORCPT ); Sun, 15 May 2022 03:31:38 -0400 Received: from mail-pj1-x1034.google.com (mail-pj1-x1034.google.com [IPv6:2607:f8b0:4864:20::1034]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DCD6A13F9A for ; Sun, 15 May 2022 00:31:37 -0700 (PDT) Received: by mail-pj1-x1034.google.com with SMTP id l7-20020a17090aaa8700b001dd1a5b9965so11491286pjq.2 for ; Sun, 15 May 2022 00:31:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=SAlHBmhRXSG1w6+RO5Otw0BeQCwtfqDdnloabN9+jc0=; b=pjGychsbvEWxCzLmZBM5mXN3AAfgSNYlgqKlkSX/XeQc+xXJIce93j/F7qhlD3TgEU 0aBKkHWzJo9rd6KEnGwKr+GivnVGvdXbab6rkZ6mW8coMIWOnkp6/ciovP19zKsWSz8S gsONBidAKVO+tJjQobpBOVfqyZnGt4KtjuaUOvU2JcYjkZwNZSM4b/qhhjLhbLDUL+2H /u+Tp+wp5nQ/nvJ4g2eAYDApHEQ1JlEglj7wl8cryfeAWG1YeOSilXiz3aSqDcqSPczg 2EUb6WZ7q65CFeuVqvtC5C2BbTFMigvCzLlmbGtEVdmPL6kCpLaGI0NzNx8DCls8CT6F VNPg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=SAlHBmhRXSG1w6+RO5Otw0BeQCwtfqDdnloabN9+jc0=; b=xs2bs3PfSL6zouw6VUTtF2yfZzeEX/QFxUIKmCcEKCIKu0JjsTkzhsyhJoNZ10bG0y xrT33+1y4wHjdf73G8O6IIOnk25NGGJdOa9vcCpFNUOER0fK9qVmW8R+qsA/XlPSAcdX KKeeu6VTwq43Of7vB7pTx1aYXJjDrTjj0gQQqbRf4oETO/EqDJToWw8lMl6uGOP1S8gw VNeMPYivKJo7e13n/q1YBhYxuOTbr9hdWqBMyCMMRrHcFOGlM8/5qvGnhdwYV505AS3K zZffoaXUZ7rhJfhPwfGK7mRcXejnLDbQieZnqzG4/XJeBaevZO3klMWY2i8omos1wIie eu6A== X-Gm-Message-State: AOAM532Q2SET860D9/OjTrQwaL41higyWxp//JGoQ2v/TqSgZh3DvVpe moiO7VaXUMsAxciBl/7wN3ZpnX/5m6P59HLQPpOaoA== X-Google-Smtp-Source: ABdhPJyuMTl8iF2ROz1Gdyl9VRD5Z6pWvB0mydIwwGio29wsfjjZPr0N67GC2YN9tufpMUjRpubjtQ== X-Received: by 2002:a17:90a:d3d2:b0:1dd:30bb:6a45 with SMTP id d18-20020a17090ad3d200b001dd30bb6a45mr25034221pjw.206.1652599897067; Sun, 15 May 2022 00:31:37 -0700 (PDT) Received: from f34-buildvm.eng.vmware.com ([66.170.99.2]) by smtp.googlemail.com with ESMTPSA id t12-20020a1709028c8c00b0015e8d4eb28esm1767058plo.216.2022.05.15.00.31.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 15 May 2022 00:31:36 -0700 (PDT) From: Shreenidhi Shedi X-Google-Original-From: Shreenidhi Shedi To: paul@paul-moore.com, eparis@redhat.com Cc: linux-kernel@vger.kernel.org, linux-audit@redhat.com, yesshedi@gmail.com, Shreenidhi Shedi Subject: [PATCH 1/2] audit: remove redundant data_len check Date: Sun, 15 May 2022 13:01:09 +0530 Message-Id: <20220515073110.304193-1-sshedi@vmware.com> X-Mailer: git-send-email 2.36.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org data_len is already getting checked if it's less than 2 earlier in this function. Signed-off-by: Shreenidhi Shedi --- kernel/audit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/audit.c b/kernel/audit.c index 7690c29d4..0749211d5 100644 --- a/kernel/audit.c +++ b/kernel/audit.c @@ -1390,7 +1390,7 @@ static int audit_receive_msg(struct sk_buff *skb, struct nlmsghdr *nlh) str); } else { audit_log_format(ab, " data="); - if (data_len > 0 && str[data_len - 1] == '\0') + if (str[data_len - 1] == '\0') data_len--; audit_log_n_untrustedstring(ab, str, data_len); } -- 2.36.1 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 80F3FC43219 for ; Sun, 15 May 2022 19:42:42 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-520-oV1S3ifxOry8MazJbZrdkw-1; Sun, 15 May 2022 15:42:38 -0400 X-MC-Unique: oV1S3ifxOry8MazJbZrdkw-1 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 832803C021B3; Sun, 15 May 2022 19:42:36 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6DC6B568CCF; Sun, 15 May 2022 19:42:36 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 93709194707C; Sun, 15 May 2022 19:42:34 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id A5C3C19451F0 for ; Sun, 15 May 2022 07:31:45 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 7452A2166B16; Sun, 15 May 2022 07:31:45 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast01.extmail.prod.ext.rdu2.redhat.com [10.11.55.17]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6FEFC2166B4A for ; Sun, 15 May 2022 07:31:42 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.81]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 0B21C85A5A8 for ; Sun, 15 May 2022 07:31:42 +0000 (UTC) Received: from mail-pl1-f177.google.com (mail-pl1-f177.google.com [209.85.214.177]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-489-dy0WOiIrOeS5v_Vi5GaNTA-1; Sun, 15 May 2022 03:31:38 -0400 X-MC-Unique: dy0WOiIrOeS5v_Vi5GaNTA-1 Received: by mail-pl1-f177.google.com with SMTP id d22so11682008plr.9; Sun, 15 May 2022 00:31:37 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=SAlHBmhRXSG1w6+RO5Otw0BeQCwtfqDdnloabN9+jc0=; b=Gly2uR1jtpR90CquuvsbHcJ7s4ST4DjfifjXV40he2mBPNPjNQ9GEh/dB1U0Cj2LgQ ixOC0odMhj/NsskE+VlDFQJqX+KMI2xvc5L9vMnJeRqYUQrCGOIT9uF6DwMlhJc3rcEu cK4y4q5bCCNpRCooE/T26G0OG9QOQfW+ZSA8DR3LqpiYwyf9PaZZ/K1nuM5lPHJJr/3u NZVCGrvyYsqIsVuXswnCPjh2y+tX3/p5dkze9QvfQClB2GqyibfYr4K+TKsncQXYRKzv wjws5HqAAFGriofJKp/vm6zjLENhr+EsOTxOs9+FWrqtmSTnIoHG4PJHHFGlgaE4CIp/ 1Twg== X-Gm-Message-State: AOAM530jRHD+PXn29lFz8Q5JqYLuc2ddUjvxoDzTgOAfT/jv64lnOK4U 6V0SkOmXTOgc81SY8h5/ZoM= X-Google-Smtp-Source: ABdhPJyuMTl8iF2ROz1Gdyl9VRD5Z6pWvB0mydIwwGio29wsfjjZPr0N67GC2YN9tufpMUjRpubjtQ== X-Received: by 2002:a17:90a:d3d2:b0:1dd:30bb:6a45 with SMTP id d18-20020a17090ad3d200b001dd30bb6a45mr25034221pjw.206.1652599897067; Sun, 15 May 2022 00:31:37 -0700 (PDT) Received: from f34-buildvm.eng.vmware.com ([66.170.99.2]) by smtp.googlemail.com with ESMTPSA id t12-20020a1709028c8c00b0015e8d4eb28esm1767058plo.216.2022.05.15.00.31.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 15 May 2022 00:31:36 -0700 (PDT) From: Shreenidhi Shedi X-Google-Original-From: Shreenidhi Shedi To: paul@paul-moore.com, eparis@redhat.com Subject: [PATCH 1/2] audit: remove redundant data_len check Date: Sun, 15 May 2022 13:01:09 +0530 Message-Id: <20220515073110.304193-1-sshedi@vmware.com> MIME-Version: 1.0 X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-Mailman-Approved-At: Sun, 15 May 2022 19:42:32 +0000 X-BeenThere: linux-audit@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux Audit Discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-audit@redhat.com, linux-kernel@vger.kernel.org, Shreenidhi Shedi , yesshedi@gmail.com Errors-To: linux-audit-bounces@redhat.com Sender: "Linux-audit" X-Scanned-By: MIMEDefang 2.85 on 10.11.54.9 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=linux-audit-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit data_len is already getting checked if it's less than 2 earlier in this function. Signed-off-by: Shreenidhi Shedi --- kernel/audit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/audit.c b/kernel/audit.c index 7690c29d4..0749211d5 100644 --- a/kernel/audit.c +++ b/kernel/audit.c @@ -1390,7 +1390,7 @@ static int audit_receive_msg(struct sk_buff *skb, struct nlmsghdr *nlh) str); } else { audit_log_format(ab, " data="); - if (data_len > 0 && str[data_len - 1] == '\0') + if (str[data_len - 1] == '\0') data_len--; audit_log_n_untrustedstring(ab, str, data_len); } -- 2.36.1 -- Linux-audit mailing list Linux-audit@redhat.com https://listman.redhat.com/mailman/listinfo/linux-audit