Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp5015633pxb; Sun, 7 Nov 2021 03:26:14 -0800 (PST) X-Google-Smtp-Source: ABdhPJwfWGqUQmgPs7zcFpMTiLAgjV37xSk9/7B5qGnocAcfxDabvRgeWa8FlhHe9w0Ulxm44Hqh X-Received: by 2002:a92:2903:: with SMTP id l3mr42198333ilg.35.1636284374773; Sun, 07 Nov 2021 03:26:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1636284374; cv=none; d=google.com; s=arc-20160816; b=OkJ5glg+ZiGV0oEMyjxHo1smbnxy2CKLAImWL5YXAhhfE8y1ExtY9cO4gcSDFrb4eo DfjGrlWYKRH3uIN9AmGtpe4siwCnarV3jJDTwgXZtTaxn7EmX6eUKADAI5p3bbujaLO4 8KFSmbjV/jp5cu5BOFZ2v9oKxZbv6+LLwtsggtIVAMmfINO7+/f+pawXwkzLBhnhRbX0 AxqX9kMKCTXE33MdrEkO2ZyWMz90AmTqmulxVIzBa+tSJaDjOIU2pb4QTbz+qNxVpXQ5 ETzB/W3ySWIs5Hobj9mOFKY99ztOdiCskMSo54QLW5HGRns/BXphtv70ZVf/Bt1GBEM2 npeQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=OLTG0u8ieZ9jRhg6/M47315MShySzmtKj2Fb0QDROGY=; b=dTJCgC8QmrJKhTbS0ozvBPnytW0x0iS1E7wFswx0tOWag5G6Ux8xVd3VZ3JHKc4wBy 3DocvnwrQmJb5YWSchvyi5IjXW6Kq6/juvU0sCM6107nEKPvJN6priAbXnZC4vJg64R4 YhvNAGY73KHkfSSEIVlckkdv8PZB/ECDooqNmLKpifhcUCXSY3wwY8aQMiuGL6T5Mqig kEemhiP3sqXvnUqL7Tl/pkqzz+xqf6C153p/QPmkk7/xCSZCyxPZBoLlm1arWiK1m+sp c5jAAOnzaykJwtPUoPJsvE08VBVF9NdXWUkERCtv3sg1j+XqUESpvrbulfbfscv+mHvT 8YvQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=YhmknN8z; 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 g124si16609454jab.72.2021.11.07.03.26.01; Sun, 07 Nov 2021 03:26:14 -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=YhmknN8z; 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 S234680AbhKFWUa (ORCPT + 99 others); Sat, 6 Nov 2021 18:20:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50244 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230119AbhKFWU3 (ORCPT ); Sat, 6 Nov 2021 18:20:29 -0400 Received: from mail-ot1-x331.google.com (mail-ot1-x331.google.com [IPv6:2607:f8b0:4864:20::331]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A1344C061570; Sat, 6 Nov 2021 15:17:47 -0700 (PDT) Received: by mail-ot1-x331.google.com with SMTP id g25-20020a9d5f99000000b0055af3d227e8so14518005oti.11; Sat, 06 Nov 2021 15:17:47 -0700 (PDT) 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; bh=OLTG0u8ieZ9jRhg6/M47315MShySzmtKj2Fb0QDROGY=; b=YhmknN8zjxUrOWDVwhSPJyQ9aiJPSt2+tyolatIz49/tol8F6h7b59v8lcPKKQu+yg SxUXwqj9C8Uk9dxUamZNyPuS3v/U/AG9QeWdhi3iAPr0NNBCBWOq2rG/hVH+ma0fnPOK V6kETdccqRzyzz6cXTMYGofp1WKLqiu++9HuzX4ew5lZSf58hwVfXS/Y1oXiwR9A4siG RVswpfdzW5aa788dwggM93OK628YFZFMgwdbU7VKPwFsDkfKcWHf44NZWLDFU+W1uO6T BPS2cwAPlh/+T+tRKkDTMdtLLcEIUoegub5WK4dv281qD3FvY5aKuvf0rmoE0omdydA/ RmJg== 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; bh=OLTG0u8ieZ9jRhg6/M47315MShySzmtKj2Fb0QDROGY=; b=BG/ryYkHJ7u6D9GwCKTCJYVJhyF+fI/2RA58zYLONjOBrrKB6vyyhaXHG4tKHZSikp DKVp5oaWUeSqsceC6x+u1UpGg3B15pwtg0r1o9LLPMekxYaOTXJPogKVg01g8EuTwC2H QmsdvwOHV7vUNjO+13fz6HJ6ItRZ7oOLb5pdFbDy2hNyXlXtUm14laAqZm06JnrlzmSs FYZEyBTEb5lprO8LygveONqrII8ifgw9hvmCY69n18ULfgL/EeXsu3X+YxMUYQhjNPOl AFfTcs/AiGz0m568uAA1laAh+XrunbuPiQj11Yakp3UoCPhA8QYl3kuTT9SSw1F1Wv7A TU6g== X-Gm-Message-State: AOAM530QauoUHuxlb1VMSTNc8E4cQl/uQQNfSsX49jy/VMO5k4R86oIH pYC3oHb4RhdFMkaoyYEgeWhKLoQ9InDIGCz091s= X-Received: by 2002:a9d:7617:: with SMTP id k23mr37166407otl.351.1636237066953; Sat, 06 Nov 2021 15:17:46 -0700 (PDT) MIME-Version: 1.0 References: <20211106220315.392842-1-ajaygargnsit@gmail.com> <8d0346ba-4819-c25e-f208-0b51116d9147@gmail.com> In-Reply-To: <8d0346ba-4819-c25e-f208-0b51116d9147@gmail.com> From: Ajay Garg Date: Sun, 7 Nov 2021 03:47:34 +0530 Message-ID: Subject: Re: [PATCH v3] tty: vt: keyboard: add default switch-case, to handle smatch-warnings in method vt_do_kdgkb_ioctl To: Pavel Skripkin Cc: gregkh@linuxfoundation.org, jirislaby@kernel.org, andriy.shevchenko@linux.intel.com, kernel@esmil.dk, linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Nov 7, 2021 at 3:42 AM Pavel Skripkin wrote: > > On 11/7/21 01:03, Ajay Garg wrote: > > diff --git a/drivers/tty/vt/keyboard.c b/drivers/tty/vt/keyboard.c > > index c7fbbcdcc346..b83e7669658d 100644 > > --- a/drivers/tty/vt/keyboard.c > > +++ b/drivers/tty/vt/keyboard.c > > @@ -2090,6 +2090,12 @@ int vt_do_kdgkb_ioctl(int cmd, struct kbsentry __user *user_kdgkb, int perm) > > > > ret = 0; > > break; > > + default: { > > + kbs = NULL; > > + ret = -ENOIOCTLCMD; > > + > > + break; > > + } > > Are these brackets needed here? There are no local variables inside > default case. Hmm, * case KDGKBSENT: uses braces. * case KDSKBSENT: does not use braces. I based the layout for default-case on the same lines as case KDGKBSENT: , as I prefer explicit braces :)