From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-oi1-f195.google.com (mail-oi1-f195.google.com [209.85.167.195]) by mx.groups.io with SMTP id smtpd.web11.11572.1597329950429100419 for ; Thu, 13 Aug 2020 07:45:50 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="no key for verify" header.i=@mab-labs.com header.s=google header.b=a4fj1mXY; spf=softfail (domain: mab-labs.com, ip: 209.85.167.195, mailfrom: mab@mab-labs.com) Received: by mail-oi1-f195.google.com with SMTP id n128so1407881oif.0 for ; Thu, 13 Aug 2020 07:45:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mab-labs.com; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=p2isO17N/RPW9P0bDPZGpHfE1s5DrGWEWwk3rWxfslM=; b=a4fj1mXYObuad0duvTqFbFBezEvfN4GOQCfg8M7nD9besD9Wqo7QR9JRbvMoYb1Wco ohuF/iukSnI7ALrA0WFtGh0Ievte5lqYQw55MEvz4JBVlWZ7qi1nd1MVsA+Yum5+9fxm Y3KLmt4IXMTK31kuRuYd/wAGi5IEdkywjgXPCFiEGVNiGN6izBGUoM8QFkefawQAG+Ef YyjntZaQjUIEeCiosbY6AgHldp6re7t3EtXdBTiEiNCUqnehrNM6UG9QueTTFyGww/RN McLeVhSt13dpgZgWIls8PbNm4zBRfpFV30k07M4ISjan4D/ueWivfkG2I8nDgOZjbsBA oVnA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=p2isO17N/RPW9P0bDPZGpHfE1s5DrGWEWwk3rWxfslM=; b=P7nsXBW1Lpb3l35XhUX99l6kFxicFpHLBohNnOaeTE2KLGgonmEHGWahVbUta61F/o PxycxUpkbYPUK3cQzzF/p+0UVr1Up6dH+KoRlgmkzcCWyTprvbtGhJb9PwQi/0AFTvbR BwDUIvRvR1EerqnX02Bij43DWoVO+FWJb7omRER4kRkyWUaFwZt2tNhiRRdwz7k2k45/ Gu/ENeBSYWcF6Bx9gNS9d/aUXh1mYZct2U0HnTC8GCh7LbLBtXYoVbCpWZcbI5F0Odt1 ViCl13vzGNwDlQw1XPIQiZQTL9GOiD4tMF/BksPbA0kT/uiSYKgdx4Cs1Kn4rGf0O7Zo gMAw== X-Gm-Message-State: AOAM530ZxL/ekYr5rLPoLemHBwWZncR3N2nk5o4pX8ywTN9b68TF6Y3j xTkm7HMZ3VlaIsao/x4OTclnRmV0gS/rCOECwBawFw== X-Google-Smtp-Source: ABdhPJy6DLX7RZr6uku1K134d4YYtZaAPetSidFUIlEXO0vqspvVXe8YOOPOJvYJbhAhaygevIbNfa2vaM3o4DIa3ig= X-Received: by 2002:aca:240b:: with SMTP id n11mr3802418oic.47.1597329948725; Thu, 13 Aug 2020 07:45:48 -0700 (PDT) MIME-Version: 1.0 References: <20200812234322.32355-1-mab@mab-labs.com> <9e9c2f28-b4e4-698d-f424-6973c486576f@linuxfoundation.org> <162ADAEB16525C4A.3117@lists.elisa.tech> In-Reply-To: <162ADAEB16525C4A.3117@lists.elisa.tech> From: "Mohammed Billoo" Date: Thu, 13 Aug 2020 10:45:37 -0400 Message-ID: Subject: Re: [linux-safety] [PATCH] coccinelle: misc: Check for hard-coded constants To: Mohammed Billoo Cc: Shuah Khan , linux-safety@lists.elisa.tech Content-Type: multipart/alternative; boundary="0000000000002f37af05acc35c52" --0000000000002f37af05acc35c52 Content-Type: text/plain; charset="UTF-8" I also had a few more questions regarding the overall format: 1. Is the header format in the semantic patch acceptable (i.e. referencing the CWE that this particular semantic patch aims to address)? 2. Should we create a separate directory for ELISA within coccinelle? Thanks Mohammed On Thu, Aug 13, 2020 at 10:42 AM Mohammed Billoo via lists.elisa.tech wrote: > Shuah, > > Apologies for the spam. I didn't format the initial correctly and needed > two more tries to get it right (according to the kernel > standard/best-practice). I can resubmit this patch. > > Thanks > > On Thu, Aug 13, 2020 at 10:39 AM Shuah Khan > wrote: > >> Hi Mohammed, >> >> Thanks for your patch. >> >> On 8/12/20 5:43 PM, Mohammed Billoo wrote: >> > This semantic patch looks for variables that are initialized to >> > constants, arrays that are both declared and indexed with constants. >> > A false positive will occur when a variable is initialized to 0, which >> > must happen for auto variables. This will be resolved in a future patch. >> > >> > The patch was tested against the following snippet: >> > >> > int main() >> > { >> > int iarr[54]; /* instance 1 */ >> > int j = 0; /* instance 2 */ >> > int i = 1; /* instance 3 */ >> > iarr[0] = 3; /* instance 4 */ >> > return 0; >> > } >> > >> > and it correctly identified instances 1, 3, and 4. It incorrectly >> > identified instance 2, which will be addressed in a future patch. >> >> Please include the output from the tool that corresponds to your >> changes to the script in the commit log on a kernel file. >> >> Also I see 3 patches with incremental changes to the script. Please >> make this a patch series which will make it easier for reviewers. >> >> thanks, >> -- Shuah >> > > > -- > Mohammed A Billoo > Founder > MAB Labs, LLC > www.mab-labs.com > 201-338-2022 > > > -- Mohammed A Billoo Founder MAB Labs, LLC www.mab-labs.com 201-338-2022 --0000000000002f37af05acc35c52 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
I also had a few more questions regarding the overall= format:
1. Is the header format in the semantic patch acceptable= (i.e. referencing the CWE that this particular semantic patch aims to addr= ess)?
2. Should we create a separate directory for ELISA within c= occinelle?

Thanks
Mohammed

On T= hu, Aug 13, 2020 at 10:42 AM Mohammed Billoo via lists.elisa.tech <mab= =3Dmab-labs.com@lists.elisa.tech> wrote:
Shuah,

Apologies for the spam. I didn't format the initial correctly a= nd needed two more tries to get it right (according to the kernel standard/= best-practice). I can resubmit this patch.

Th= anks

On Thu, Aug 13, 2020 at 10:39 AM Shuah Khan <skhan@linuxfoundation.org= > wrote:
Hi M= ohammed,

Thanks for your patch.

On 8/12/20 5:43 PM, Mohammed Billoo wrote:
> This semantic patch looks for variables that are initialized to
> constants, arrays that are both declared and indexed with constants.<= br> > A false positive will occur=C2=A0 when a variable is initialized to 0= , which
> must happen for auto variables. This will be resolved in a future pat= ch.
>
> The patch was tested against the following snippet:
>
> int main()
> {
>=C2=A0 =C2=A0 =C2=A0 int iarr[54]; /* instance 1 */
>=C2=A0 =C2=A0 =C2=A0 int j =3D 0;=C2=A0 =C2=A0 /* instance 2 */
>=C2=A0 =C2=A0 =C2=A0 int i =3D 1;=C2=A0 =C2=A0 /* instance 3 */
>=C2=A0 =C2=A0 =C2=A0 iarr[0] =3D 3;=C2=A0 /* instance 4 */
>=C2=A0 =C2=A0 =C2=A0 return 0;
> }
>
> and it correctly identified instances 1, 3, and 4. It incorrectly
> identified instance 2, which will be addressed in a future patch.

Please include the output from the tool that corresponds to your
changes to the script in the commit log on a kernel file.

Also I see 3 patches with incremental changes to the script. Please
make this a patch series which will make it easier for reviewers.

thanks,
-- Shuah


--
Mohammed A Billoo
Founder
MAB Labs, LLC<= /div>
201-338-2022



--
Mohammed A Billoo
Founder
MA= B Labs, LLC
201-338-2022
--0000000000002f37af05acc35c52--