From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx0b-00069f02.pphosted.com ([205.220.177.32]:3132 "EHLO mx0b-00069f02.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231326AbiAJMme (ORCPT ); Mon, 10 Jan 2022 07:42:34 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=date : from : to : cc : subject : message-id : references : content-type : in-reply-to : mime-version; s=corp-2021-07-09; bh=hrhE5JCkohk6BnROmsO3vrwttAhnT1EGUr4NG6WkHJ4=; b=CHjS+yF8yawUQPWsvk5ds00um4DCXY8P8vsriHQYUty6fJQ/z5zUWv52qp080FofW2vF XDbG1HtJPawTtuy2mwpNTdVsRLmzzraUbE0UfzMq2ZuDj+8psWSgBFdQSX3TgMhZpyq2 USo6+AMlm+Y04mMFm/0HXqzp3DCWg94qtwh2Z/9mjHH0IB3zckZVbLZbbhrqS0iwv0gh 0f/RD69voPzMAkpXfcbrzLe/9lmf+sYONPr/eYS774/LKSMc9X0Qfh7lFa1GoeQaDstO I2LyYvKVc9yZOsFxjezLHtGoHV1GIQ8L4mH4axpx35FFrnqnXRY0X519DKWfY1LHdq+H 6Q== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=hrhE5JCkohk6BnROmsO3vrwttAhnT1EGUr4NG6WkHJ4=; b=GJrquk4WBK7P7siFniHH7MiqkoG5s1JZ73nEH4iq0GYSbn0jCCIBSoAsMzwBy6y4CxcIpltTmadA48NFMQlQ68DUamfzQZ9myt93ifX7CuyJpEbO2s6/4oLW55/F49fjr53qlpSCZL765yEbHVM5815BLAt1i4Y9TNtbKfxmZ/c= Date: Mon, 10 Jan 2022 15:42:10 +0300 From: Dan Carpenter Subject: Re: FW: [error27/smatch] smatch misidentifies uninitialized variable after switch with no default: (Issue #3) Message-ID: <20220110124210.GC1978@kadam> References: Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: MIME-Version: 1.0 List-ID: To: "Brandeburg, Jesse" Cc: "smatch@vger.kernel.org" Thanks for the bug report. The ideal way to fix this would be to handle it in Smatch core so that if called get_implied_rl(cmd, &rl) then it would return 0-2. Unfortunately, that's quite a bit of work to implement it properly... For now, I'm just going to add a special case in check_uninitialized.c to silence these warnings. If you have a switch(some_enum) and there is no default statement, then mark all the partially initialized variables as fully initialized. regards, dan carpenter