Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp6181251pxb; Mon, 8 Nov 2021 04:36:11 -0800 (PST) X-Google-Smtp-Source: ABdhPJzVMG2Ekr3V+HdPmO8+E07h1siKyJ/Vb04pCSym66CTZTlI0IS9NXmFkzCokMPfJYUzCyn2 X-Received: by 2002:a05:6e02:1025:: with SMTP id o5mr56262871ilj.133.1636374971311; Mon, 08 Nov 2021 04:36:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1636374971; cv=none; d=google.com; s=arc-20160816; b=0F6lpXXtijuRYfCOGOzldxanNHn/gzwqsLvpc/owOwRDrSI6P1zNoPW0QleQAx2Lkl vYccJOumr5z6T539qNH+f52HyEeLpoBPlCHBMKIbOpkz6KTBIBqVBrtpqtbRGXV3GuqD CJc20o16hoayj5HATcctSoMXl+Fd1z9U8jHMrhHEpXeovnvKW/wHPWoUH9Ez98zmuT86 dkKjA2T+UeV2K9d2Ite5swLsK4FkhpLvIYVImJ7CT1udo8KKsD5VkdJ8xTCdCA5+0vG1 gCsXYgYvLf7UORu/1aYrsjfF1xFLYcNAcFJBws291y0fjBFuvuU+nKHtZdWEt0K5RrH5 a34Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=gw2FCiC4aWMJkxXuSfsSyIQD/E2YOZ+rOt07PIe4WUk=; b=S6FEpXfVSU37Mec6zNgOyfSiWY0TKNZMeYsuIlfkpOiTtmFG7MgOlGj302FRLat48D 8gS4+qIAZ+B0dx6KGphHXI5CDYJ9YJYcg4cLGkDwbz0NX6qRXu0W4pJq22PW0JDaC8Nl pLYIw1gPvLV6ahv7BYgKqopnG4xSjckokZiECPlUxvldIe4TipA1fQaYeOxCJx/iJTn7 0xe/+mhzH8lWu3erthlc8CHQfbPuB1s7/FtHP5J9ZTtdOyOrfmelmELQ2I6hztoXmRDe hwRKEAjivCd7Z0KgyOe6VOD2ewlxod055UKwmDOhcsfKXV+agMqFLFiORUhGbf0bKbuP wuwQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=lePT8Rwn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e65si12414906jac.93.2021.11.08.04.35.54; Mon, 08 Nov 2021 04:36:11 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=lePT8Rwn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238064AbhKHIkI (ORCPT + 99 others); Mon, 8 Nov 2021 03:40:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45178 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238052AbhKHIkE (ORCPT ); Mon, 8 Nov 2021 03:40:04 -0500 Received: from mail-ed1-x52c.google.com (mail-ed1-x52c.google.com [IPv6:2a00:1450:4864:20::52c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C5C3CC061570; Mon, 8 Nov 2021 00:37:20 -0800 (PST) Received: by mail-ed1-x52c.google.com with SMTP id m14so58587127edd.0; Mon, 08 Nov 2021 00:37:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=gw2FCiC4aWMJkxXuSfsSyIQD/E2YOZ+rOt07PIe4WUk=; b=lePT8RwnrYKsnAX0P3RcP2YZ15dkGBdbdcfdCJiIZIkqACbd8MNCnTsQo32jZcyh8I 7qlPKUtpPDqkAdRRQVkCvo9p66rgHfqoSncXue538YVl9c6k5LPnCaVi4YKovB0EDfGP PuLyMNXXztyWOcaL/0R/HyJ7RbNG+u32K2WxF4I8w7zK+VdzzmW7lBkLpBtQqtHJJXrX JqEWrROMPNPesAqD38x8GkQlFA1Vn2n1yzB25xzNKwVdgBNwDjajt7IGviTKOsqRa1gI A8Q6oW7JrZOlWER1lG1iiK477DopN5XsWIItUaJStFl5vD7atAENM89NZHVHDGuMnmpR zsYA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=gw2FCiC4aWMJkxXuSfsSyIQD/E2YOZ+rOt07PIe4WUk=; b=dh+AKkGnVHNUN51OWENFofyw0XluBDkg9hhm/zBRbBhSm8KLYAt3jKI8RdBZO4qXPH nACtc5gB5FM4TI+czDGVkKsE3K3qKaXXGfJBp/QpHUZSZ9WIqbYbnxEMzKiG5GqqnPlS 8I8dvgAgaLkilN1rbUR1+1ZzShkQ1cyEz6c1BdxpjopUnQOQhlsVno/do8Xya+z1lYQT ZemgR+9T490YzYwC5fUh+wz5j8dsyv/CCFeYVVQ+ofuo3FHEzMhOUGF21J3bCzJnvMko bTUn0Hgz0ioj2nyTCHhZfj7+2DToMCconrUKJHMA3Q2IDdGNfEPjdmD931nrgT3Lrsje 6UrQ== X-Gm-Message-State: AOAM530cBwVflPbvrmyt0wvJ3ScN1bSLduw14EEYpLLAGuse0Z9c/ZSG 7lKeduMrA9UNdGNPZr+7eaanrekUzdNcqp84KhSlLjjCLhw= X-Received: by 2002:a17:906:bccc:: with SMTP id lw12mr28140316ejb.128.1636360639432; Mon, 08 Nov 2021 00:37:19 -0800 (PST) MIME-Version: 1.0 References: <20211107031721.4734-1-ajaygargnsit@gmail.com> In-Reply-To: <20211107031721.4734-1-ajaygargnsit@gmail.com> From: Andy Shevchenko Date: Mon, 8 Nov 2021 10:36:33 +0200 Message-ID: Subject: Re: [PATCH v4] tty: vt: keyboard: add default switch-case, to handle smatch-warnings in method vt_do_kdgkb_ioctl To: Ajay Garg Cc: Greg Kroah-Hartman , Jiri Slaby , Andy Shevchenko , Emil Renner Berthing , "open list:SERIAL DRIVERS" , Linux Kernel Mailing List , Pavel Skripkin Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Nov 7, 2021 at 4:10 PM Ajay Garg wrote: > > smatch-kchecker gives the following warnings when run on keyboard.c : > > vt_do_kdgkb_ioctl() error: uninitialized symbol 'kbs'. > vt_do_kdgkb_ioctl() error: uninitialized symbol 'ret'. > > This usually happens when switch has no default case and static > analyzers and even sometimes compilers can=E2=80=99t prove that all possi= ble > values are covered. > > One blank line is enough. > Thus, the default switch-case has been added, which sets the values > for the two variables : > > * kbs as NULL, which also nicely fits in with kfree. > > * ret as -ENOIOCTLCMD (on same lines if there is no cmd > match in "vt_do_kdskled" method). > > > Many thanks to the following for review of previous versions : > > * Pavel Skripkin > * Andy Shevchenko > > Ditto for each such case. ... > + default: > + kbs =3D NULL; > + ret =3D -ENOIOCTLCMD; Why is this? How is it supposed to work? > + break; > } --=20 With Best Regards, Andy Shevchenko