From patchwork Thu Mar 10 13:23:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Young X-Patchwork-Id: 81454 X-Patchwork-Delegate: sean@mess.org Received: from vger.kernel.org ([23.128.96.18]) by www.linuxtv.org with esmtp (Exim 4.92) (envelope-from ) id 1nSIlr-00Gj7q-Ox; Thu, 10 Mar 2022 13:24:00 +0000 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242373AbiCJNY6 (ORCPT + 1 other); Thu, 10 Mar 2022 08:24:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43400 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236943AbiCJNY5 (ORCPT ); Thu, 10 Mar 2022 08:24:57 -0500 Received: from gofer.mess.org (gofer.mess.org [IPv6:2a02:8011:d000:212::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C1DE09A4DC; Thu, 10 Mar 2022 05:23:52 -0800 (PST) Received: by gofer.mess.org (Postfix, from userid 1000) id D40B310001B; Thu, 10 Mar 2022 13:23:50 +0000 (UTC) From: Sean Young To: linux-media@vger.kernel.org Cc: Dan Carpenter , smatch@vger.kernel.org Subject: [PATCH] media: lirc: suppress false positive smatch warning Date: Thu, 10 Mar 2022 13:23:50 +0000 Message-Id: <20220310132350.78729-1-sean@mess.org> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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-media@vger.kernel.org X-LSpam-Score: -2.4 (--) X-LSpam-Report: No, score=-2.4 required=5.0 tests=BAYES_00=-1.9,HEADER_FROM_DIFFERENT_DOMAINS=0.5,MAILING_LIST_MULTI=-1,RCVD_IN_DNSWL_NONE=-0.0001 autolearn=ham autolearn_force=no The latest smatch says: drivers/media/rc/lirc_dev.c:632 lirc_read_mode2() error: uninitialized symbol 'copied'. drivers/media/rc/lirc_dev.c:671 lirc_read_scancode() error: uninitialized symbol 'copied'. This is a false positive since in all reaching code paths, copied will be set. Work around this by providing a zero initializer for copied. Cc: Dan Carpenter Cc: smatch@vger.kernel.org Signed-off-by: Sean Young --- drivers/media/rc/lirc_dev.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/media/rc/lirc_dev.c b/drivers/media/rc/lirc_dev.c index 765375bda0c6..efa09beae6a7 100644 --- a/drivers/media/rc/lirc_dev.c +++ b/drivers/media/rc/lirc_dev.c @@ -601,7 +601,7 @@ static ssize_t lirc_read_mode2(struct file *file, char __user *buffer, { struct lirc_fh *fh = file->private_data; struct rc_dev *rcdev = fh->rc; - unsigned int copied; + unsigned int copied = 0; int ret; if (length < sizeof(unsigned int) || length % sizeof(unsigned int)) @@ -639,7 +639,7 @@ static ssize_t lirc_read_scancode(struct file *file, char __user *buffer, { struct lirc_fh *fh = file->private_data; struct rc_dev *rcdev = fh->rc; - unsigned int copied; + unsigned int copied = 0; int ret; if (length < sizeof(struct lirc_scancode) ||