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 19BD1C433E0 for ; Mon, 22 Jun 2020 18:39:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E327F20738 for ; Mon, 22 Jun 2020 18:39:14 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="g47As6pT" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730430AbgFVSjO (ORCPT ); Mon, 22 Jun 2020 14:39:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39482 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730418AbgFVSjN (ORCPT ); Mon, 22 Jun 2020 14:39:13 -0400 Received: from mail-pl1-x641.google.com (mail-pl1-x641.google.com [IPv6:2607:f8b0:4864:20::641]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BA021C061796 for ; Mon, 22 Jun 2020 11:39:13 -0700 (PDT) Received: by mail-pl1-x641.google.com with SMTP id d12so1951726ply.1 for ; Mon, 22 Jun 2020 11:39:13 -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=aL0C3ytRbXs35qBNqv1Lq6dZjnsdhYjuHZANERSXaBn1RuzdVDwHKnRHSM6yiOf0xs H1u11NWqRNrhkG7i0kgOFQheIZLRWwl+QwrS0p212GK+zazY5fpuULu0k4/mAPBmBpeo f2BN8RDo7M3Py2k7GQuvOpdb23Th1MRkYD/nlG4kTqHnbyGOa+IBbczIP9sNQVT3CJ2O TZm1Tfzr05TXNfcvaDxz/I/XRJQp05Sh9TCzoj/o3tgZ36z1krRFC1RxdM+iTazPZKx1 YJzwzWn4OWdLYE4+fQ8pdB477gMzBP9B8s+41IdQ8LQU+ruQFqzwWpV24B5V4Nu54q5H Avig== X-Gm-Message-State: AOAM530QLUVl2rFfyjt1GXUay13JCeD/hl83Z/1tw3AmsheIKuxlQpgu yBiV5c51xSxCL4k9GAKiUnScvprmMW49x4GaaLTz+Q== 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" Sender: linux-ide-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ide@vger.kernel.org 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