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 X-Spam-Level: X-Spam-Status: No, score=-14.6 required=3.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0BA61C433E3 for ; Mon, 22 Jun 2020 18:39:16 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id BFFBB20738 for ; Mon, 22 Jun 2020 18:39:15 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="g47As6pT" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BFFBB20738 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 579C86B000E; Mon, 22 Jun 2020 14:39:15 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 551196B0010; Mon, 22 Jun 2020 14:39:15 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 48DBE6B0022; Mon, 22 Jun 2020 14:39:15 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0248.hostedemail.com [216.40.44.248]) by kanga.kvack.org (Postfix) with ESMTP id 31CAA6B000E for ; Mon, 22 Jun 2020 14:39:15 -0400 (EDT) Received: from smtpin28.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id B40418248047 for ; Mon, 22 Jun 2020 18:39:14 +0000 (UTC) X-FDA: 76957710228.28.art64_580bc8e26e35 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin28.hostedemail.com (Postfix) with ESMTP id 93C3E1E48BF for ; Mon, 22 Jun 2020 18:39:14 +0000 (UTC) X-HE-Tag: art64_580bc8e26e35 X-Filterd-Recvd-Size: 6527 Received: from mail-pl1-f195.google.com (mail-pl1-f195.google.com [209.85.214.195]) by imf11.hostedemail.com (Postfix) with ESMTP for ; Mon, 22 Jun 2020 18:39:14 +0000 (UTC) Received: by mail-pl1-f195.google.com with SMTP id d8so7928557plo.12 for ; Mon, 22 Jun 2020 11:39:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=Gb+JetmJfxvfJpxHC8m6WwdUvvjtG/PEO/NrvZ7SUq0=; b=g47As6pTItcLFTPBKcE7GoqTMDitRniLcUVZb/sgo6Z6hU1SBXf3XA30MossVWhFm+ WrZs8HM7KrKN7vIEe4hAi7PM9veaLBUBzmO1d6hg/ZrKjGDYlC+J8mnlzIu7m8jCiDVX oUMZ6YXzkXP7P/9ND3v2M3GdghI0Eiq5bwNDzgs5cWvWuZbpdd3bSkITbG7/ShPdrwrX oq7EH8OJ65SqfDB5bRXrhOWPzVNj9lb6ggrqKdEFfG/SWqJeDT88TfoVD+co4a3hK8cD TZxZzP6pibR5VmEHPFJiQguXyVlIy2oApu1xDzwGn7gtMfXUFW3LNOourTReEdtotVmu 1u6A== 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=Gb+JetmJfxvfJpxHC8m6WwdUvvjtG/PEO/NrvZ7SUq0=; b=DS1Is8mgoDG9PhqY3eOS4xBzhBAHeKKtPlR1q7E/HmrAuo1N6eE7D7Lft+napXC+GQ xIOa/MowVD/k2/ZI38gGM1xW7SB7iHcrHGAOrqEnRcUz+FnSsJG++sPmgtEsMqnz0bj/ v2q0ESULZaahc0jZqCj5oeKk1Ek5g4qKiQmvGgzNQ7dkIBkjHxOzJqr1QUOo4V2ZbULD kIrm4xZi7eCJZ489oSp5ZIIH1LWZ/AEbWsS2SLhRp/FPnu3eSm4iWznZXtDv9CdCb7wk iEAoNJ9Vnonl9WdfkXM3PZWmn3schYsEXstvUomzP0RQJADodK/lAl0gfNOiNjJX69ba 5dOQ== X-Gm-Message-State: AOAM533R0YnRg7eMgMZkQgTZcSAuSnNlVFsYAFWzvklxjtEhD1RA4Lqd szKCipVnU1eRVr1mEIP8yEcl7pDXtS140kRpsU16Nw== X-Google-Smtp-Source: ABdhPJxjYmvT3fQkCRcyhTKfiFZOdTkx+4rML9Oc+LRvsn6ucoVJwJ7PtyGZkVKmwrq2pv/vivr0Qr/enJgVlPaAiao= X-Received: by 2002:a17:902:fe8b:: with SMTP id x11mr20457257plm.179.1592851152937; Mon, 22 Jun 2020 11:39:12 -0700 (PDT) MIME-Version: 1.0 References: <20200620033007.1444705-1-keescook@chromium.org> <20200620033007.1444705-12-keescook@chromium.org> In-Reply-To: <20200620033007.1444705-12-keescook@chromium.org> From: Nick Desaulniers Date: Mon, 22 Jun 2020 11:39:01 -0700 Message-ID: Subject: Re: [PATCH v2 11/16] media: sur40: Remove uninitialized_var() usage To: Kees Cook Cc: LKML , Linus Torvalds , Miguel Ojeda , Alexander Potapenko , Joe Perches , Andy Whitcroft , "maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)" , drbd-dev@lists.linbit.com, linux-block@vger.kernel.org, b43-dev@lists.infradead.org, Network Development , Linux Doc Mailing List , linux-wireless , linux-ide@vger.kernel.org, linux-clk@vger.kernel.org, linux-spi@vger.kernel.org, Linux Memory Management List , clang-built-linux Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 93C3E1E48BF X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam01 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Fri, Jun 19, 2020 at 8:30 PM Kees Cook wrote: > > Using uninitialized_var() is dangerous as it papers over real bugs[1] > (or can in the future), and suppresses unrelated compiler warnings (e.g. > "unused variable"). If the compiler thinks it is uninitialized, either > simply initialize the variable or make compiler changes. As a precursor > to removing[2] this[3] macro[4], just remove this variable since it was > actually unused: > > drivers/input/touchscreen/sur40.c:459:6: warning: variable 'packet_id' set but not used [-Wunused-but-set-variable] > 459 | u32 packet_id; > | ^~~~~~~~~ > > However, in keeping with the documentation desires outlined in commit > 335abaea7a27 ("Input: sur40 - silence unnecessary noisy debug output"), > comment out the assignment instead of removing it. > > [1] https://lore.kernel.org/lkml/20200603174714.192027-1-glider@google.com/ > [2] https://lore.kernel.org/lkml/CA+55aFw+Vbj0i=1TGqCR5vQkCzWJ0QxK6CernOU6eedsudAixw@mail.gmail.com/ > [3] https://lore.kernel.org/lkml/CA+55aFwgbgqhbp1fkxvRKEpzyR5J8n1vKT1VZdz9knmPuXhOeg@mail.gmail.com/ > [4] https://lore.kernel.org/lkml/CA+55aFz2500WfbKXAx8s67wrm9=yVJu65TpLgN_ybYNv0VEOKA@mail.gmail.com/ > > Fixes: 335abaea7a27 ("Input: sur40 - silence unnecessary noisy debug output") Probably should comment out `/* u32 packet_id */` rather than removing it then, but that doesn't really matter. Either way, Reviewed-by: Nick Desaulniers > Signed-off-by: Kees Cook > --- > drivers/input/touchscreen/sur40.c | 4 +--- > 1 file changed, 1 insertion(+), 3 deletions(-) > > diff --git a/drivers/input/touchscreen/sur40.c b/drivers/input/touchscreen/sur40.c > index 34d31c7ec8ba..620cdd7d214a 100644 > --- a/drivers/input/touchscreen/sur40.c > +++ b/drivers/input/touchscreen/sur40.c > @@ -456,8 +456,6 @@ static void sur40_poll(struct input_dev *input) > { > struct sur40_state *sur40 = input_get_drvdata(input); > int result, bulk_read, need_blobs, packet_blobs, i; > - u32 uninitialized_var(packet_id); > - > struct sur40_header *header = &sur40->bulk_in_buffer->header; > struct sur40_blob *inblob = &sur40->bulk_in_buffer->blobs[0]; > > @@ -491,7 +489,7 @@ static void sur40_poll(struct input_dev *input) > if (need_blobs == -1) { > need_blobs = le16_to_cpu(header->count); > dev_dbg(sur40->dev, "need %d blobs\n", need_blobs); > - packet_id = le32_to_cpu(header->packet_id); > + /* packet_id = le32_to_cpu(header->packet_id); */ > } > > /* > -- > 2.25.1 > > -- > You received this message because you are subscribed to the Google Groups "Clang Built Linux" group. > To unsubscribe from this group and stop receiving emails from it, send an email to clang-built-linux+unsubscribe@googlegroups.com. > To view this discussion on the web visit https://groups.google.com/d/msgid/clang-built-linux/20200620033007.1444705-12-keescook%40chromium.org. -- Thanks, ~Nick Desaulniers