Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp2221858iof; Tue, 7 Jun 2022 23:39:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJznLuqPcLRGd/UFCmv7/ukOR3xYbxZncTgTescFY0lO2SiA3nlkOZpIogjXj9AoR3y+XV0R X-Received: by 2002:a62:c5c3:0:b0:51b:a11c:201f with SMTP id j186-20020a62c5c3000000b0051ba11c201fmr33113208pfg.71.1654670375942; Tue, 07 Jun 2022 23:39:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654670375; cv=none; d=google.com; s=arc-20160816; b=Hbq+b7Y0j2a4YcABBW78K3gMy/d4wtSecpEyTBYfueAzTgFJIKCuFFdy1Sek+oEXdc SPDIEHaAztQ65h/8/udEmYCwbtMGcb3vFywiz29vFhLCLCbET+k+w1uoQfqwc+ScbYbt 4cXZhTBOnYSBp8GPRtM3Ce/7HTS6OHalceD+7+ePv8nblFmg0Hqh0PySODBAIOZhdMmC lRU64FqdyG3hjCUvWIwrOecaIoIVxzytxHPhOlDogrEsjcVp5T1KYOwFxsgIFr9xALGI IAaYE+cxmSYDmRofwcMhUmvAzyK1CUvugB9pFC+kKDMtV3cicMnAtX2Qbfp8B3o4hQKc 1eSQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=I0TYj0aY/TkdqOtA53I+eFE0LIyvHOAIiCLx8hJBREw=; b=seoRLDXmyH/oalPyhNuR7kjPXJKurMgSXWeyyXeVkunJ0A6LLQ4cH2WC546hNIvuY0 WIVBo9f4rxgGwrehZbR91Qacx8ZCdEoowCZIzQDaSs8y4eNsUEyfgGgsZgUb6JKQpE7+ fNgluSJ22F+c/XYseL4nQ28qGWVr07FQCkLOvSeVxwD/aGiFecxPMPG0yG4E4ISAX63H o3JC4HvqcHomF5m9BqPWsYK5MtdHUsfC5m2An5rCHX7p8uRH1WpRVsGmZunO7JfAhURY +qeF0dJPiknZ8kHmggkhf8ShOUGPUVZVO+cpLolkyhlh5H3SaxjThnEuGPQ3HZ2wyfYV /gPw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@paul-moore-com.20210112.gappssmtp.com header.s=20210112 header.b="e40+dm/Z"; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id ms11-20020a17090b234b00b001e07e97c688si23026360pjb.153.2022.06.07.23.39.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jun 2022 23:39:35 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@paul-moore-com.20210112.gappssmtp.com header.s=20210112 header.b="e40+dm/Z"; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 0F88816646B; Tue, 7 Jun 2022 23:01:34 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1357051AbiFHCqc (ORCPT + 99 others); Tue, 7 Jun 2022 22:46:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38464 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1390486AbiFHCka (ORCPT ); Tue, 7 Jun 2022 22:40:30 -0400 Received: from mail-wm1-x331.google.com (mail-wm1-x331.google.com [IPv6:2a00:1450:4864:20::331]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DDF4B2533F5 for ; Tue, 7 Jun 2022 14:22:46 -0700 (PDT) Received: by mail-wm1-x331.google.com with SMTP id 67-20020a1c1946000000b00397382b44f4so10157394wmz.2 for ; Tue, 07 Jun 2022 14:22:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paul-moore-com.20210112.gappssmtp.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=I0TYj0aY/TkdqOtA53I+eFE0LIyvHOAIiCLx8hJBREw=; b=e40+dm/Z0W0bIfob5pTvP0J2RyA4XpxF11pWtEW7puVHQEiUnWvd2CVD5XctVds9Bn PShLixF5Z4+GFBxqf2YR+q4TKyj0YAyTh8B08UoCUcVGBEeXJw3LB3TDHcgY0OphiaBw BeuKOWXH2i+K+No4ln5jeT/AJUK5T9VEOcG8dUQckKV3KbXWODCdTYeGYur0rCBwOLoT rKutET82TgGy2BgoaxPWUnW8sGs6P4YskJacxjyO7dDtvzcbFv1zJoPmg+MuHPjFSbt/ RweF/zHNN6q+a6d0MWPovexRLYenU/ASh1h0PWKSbW10Qc96jNP5Nk2Ls3O4zqDzQnL6 fOZA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=I0TYj0aY/TkdqOtA53I+eFE0LIyvHOAIiCLx8hJBREw=; b=urrRMNjwJGTk0IaEctLoYSkvtax23HVD8gpiUOwmgtkrn0ZKea4fJcQUi0m4sn5bCX vD3qAatM7uOfGmVD+9Cg6N4+UpY7CPaq6Vl8Nzhw+fq56QLYXdferH7IkpQ+Et/rqMjr hxl1bah84FEZU0sJxTAFuFhAA3iz+RxQncAX28U7x6j4E5lvFHWU2NNyXrY/0DtxH51o 7rjL527Lf0wzYSgBwjx5qvJKmANRdYd5qVss93nftm8nRScqvNxqitR2KHnMsXAJKMLL QYRSYgubuwMqhorYdp48TuUg+fcrLfmtg8r+pdFYdK6BIPjLhHJsmQfn03KrztQLDYuJ lPZQ== X-Gm-Message-State: AOAM5312ewyS9UQl6gpQDvoPeiwQCXJljBBMkoSMi4awBStKRJfz7owV N18s2y9T5i6LWhbmjhKvUVZzCk/DFTXICX4xqkQY X-Received: by 2002:a05:600c:414e:b0:397:55aa:ccc0 with SMTP id h14-20020a05600c414e00b0039755aaccc0mr61566727wmm.51.1654636964669; Tue, 07 Jun 2022 14:22:44 -0700 (PDT) MIME-Version: 1.0 References: <20220217142133.72205-1-cgzones@googlemail.com> <20220217142133.72205-4-cgzones@googlemail.com> In-Reply-To: <20220217142133.72205-4-cgzones@googlemail.com> From: Paul Moore Date: Tue, 7 Jun 2022 17:22:34 -0400 Message-ID: Subject: Re: [PATCH 5/5] selinux: drop unnecessary NULL check To: =?UTF-8?Q?Christian_G=C3=B6ttsche?= Cc: selinux@vger.kernel.org, Stephen Smalley , Eric Paris , Nathan Chancellor , Nick Desaulniers , Ondrej Mosnacek , Serge Hallyn , Austin Kim , Jiapeng Chong , Casey Schaufler , Yang Li , linux-kernel@vger.kernel.org, llvm@lists.linux.dev Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Feb 17, 2022 at 9:22 AM Christian G=C3=B6ttsche wrote: > > Commit e3489f8974e1 ("selinux: kill selinux_sb_get_mnt_opts()") > introduced a NULL check on the context after a successful call to > security_sid_to_context(). This is on the one hand redundant after > checking for success and on the other hand insufficient on an actual > NULL pointer, since the context is passed to seq_escape() leading to a > call of strlen() on it. > > Reported by Clang analyzer: > > In file included from security/selinux/hooks.c:28: > In file included from ./include/linux/tracehook.h:50: > In file included from ./include/linux/memcontrol.h:13: > In file included from ./include/linux/cgroup.h:18: > ./include/linux/seq_file.h:136:25: warning: Null pointer passed as 1s= t argument to string length function [unix.cstring.NullArg] > seq_escape_mem(m, src, strlen(src), flags, esc); > ^~~~~~~~~~~ > > Signed-off-by: Christian G=C3=B6ttsche > --- > security/selinux/hooks.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) I was waiting for Nick to reply, but he never did, and this looks good to me so I just merged it into selinux/next. Thanks for your patience Christian. --=20 paul-moore.com