Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp4382096pxb; Sat, 6 Nov 2021 12:42:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyrwKwi/BIWbJ4Vm8vXw7ywlCU4oHl5MKB1bOBu9F295O6h4uYN8dX2LvVVaMi2h+77Etea X-Received: by 2002:a5e:8304:: with SMTP id x4mr4544174iom.178.1636227756177; Sat, 06 Nov 2021 12:42:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1636227756; cv=none; d=google.com; s=arc-20160816; b=Rj0I63eJYj9UTM+W4yFLX0gT09cf8tHDgcmN1qHakuuQNnkCgENDJUAk2HhOw1WxhX dPx6rETpwsIx5pw8w1oT02lSGSU3qoMljJwZXbxOa5uiRORHLZeNX9tZ+ShUnwc5qn8m akVqSfI1npnbbGt4gCoo8I++VxyhEj9dZlQiezWi0yAVw3Cf0wSsEHsyDmNkHzIf/3qu /oPxb70gj/PvWcCe8+E1PUoH+MoG1d7cKlthp4R29QRMOHnpSFodelx+hJF5IKoRbFBE OulxxuaIxOCIyfcu1U+oEC7kPfwRt9c2RySD4BPfPa3RWVadRO9F8jbucev+ALxKZA+s F0dQ== 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=+POYMDTp6W1bADv+1zpQV58ffNru2a1oFkuJEw7LceM=; b=D4NDp30NtoFtsPf95KLtL9M7i8zZZF8KenbYjHQ/sHu8Lhc0izn8XRy7Ui6Ueig/Ly nxruQdVopJQ9mJqU+MfMga3SFdkQ9BMLPML2Qa2mkxiwOgb4/5/FZj2DPkgBENLuG4kf 14pryefN8xjDRvfSeds2h2wPL07LhDpuRFpmQ3OOne4h+ppI9lSgP+lKJZQnI6UH4+P2 2cXd0cMv2jhsx8CFwDpHRJ5qq75bAxu3nWRHOqV8zW70l3TeVDL0uyJEPB6AY69WjI0n OUWCWcTFD/ItYu4qh9N0H+dYCBoXiyLo9BZcmfT0q0YdiObDx+N0G903eEbHNkVtCwqg cBpQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=cDS6jT3m; 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 l14si18502280iok.78.2021.11.06.12.42.24; Sat, 06 Nov 2021 12:42:36 -0700 (PDT) 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=cDS6jT3m; 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 S231460AbhKFMTj (ORCPT + 99 others); Sat, 6 Nov 2021 08:19:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60618 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229669AbhKFMTj (ORCPT ); Sat, 6 Nov 2021 08:19:39 -0400 Received: from mail-oo1-xc30.google.com (mail-oo1-xc30.google.com [IPv6:2607:f8b0:4864:20::c30]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 05F25C061570; Sat, 6 Nov 2021 05:16:58 -0700 (PDT) Received: by mail-oo1-xc30.google.com with SMTP id j6-20020a4aab46000000b002bb88bfb594so3997909oon.4; Sat, 06 Nov 2021 05:16:57 -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=+POYMDTp6W1bADv+1zpQV58ffNru2a1oFkuJEw7LceM=; b=cDS6jT3mPqFPQ3DEWrCVdEKL0K4a4YC9rrPpVEZqfcHkG99ywGdW4gGtVygvq77vSp pEfwt8ub/xY76sEVmRbhNTMHD+20lTCKQnqqm09A/K1KLiqOBHVa6q49G9tP3/zlKoAV nSRwCSESqn5iuDdi/bHRLOcE8vsk1SVQYZ8VA0CoRUdtOtDdVufV+v22LftFsfWHdv2X li2rnWNk/OC6w19jsEuCPWeP6mB8vuS04GYaaspg/gUKL1T/N7xM81qZWtlvpzIc+bVx 7MrRqROxO4rnQtgWjtIol/Zr3OuEmK50lFvX0SODk0Shew0MLixN6tdLWvjcZ5K9cXTO xB+g== 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=+POYMDTp6W1bADv+1zpQV58ffNru2a1oFkuJEw7LceM=; b=sbAb+HE/0xZ/iz7Scz6kxslUXqKSizLzae3DfsKbYGx1o8XnGGceDucf6hQJAomYe3 RaQV4PXwDi8C32BGnl6/ODnlKBprxJFws/DYGBLAlfmJ5DODNVXSPlDs4e/+DnOQbtIQ lNH+HLW/RMDM1XfL1UJSKtXOmPk5OU4tjKOS6h3Wc+UDFkJ3zlL17rflrvKPSqgonUix T2HclCQqVgcUvfcCxWepLgbpuB78nFK0qzdfbLInAoC+2gabB8tFL65yw9ZQ61QVbhRc kNIoQ1F+D7Nfp6QQNv0xhGWhiq4rhjWQAM20vaTVIbYYAR3LXxganD6a/g3w6+tfeiuF xcig== X-Gm-Message-State: AOAM532fL6eU9S/x1DSmPOg787moA0uyw0A3JwVciunqLjJz+dkfUZRJ QSlRsJHFAi/+bpnn0yyyh8BDBqAnTFLUBAUPGY8= X-Received: by 2002:a4a:d5c8:: with SMTP id a8mr13017354oot.18.1636201017393; Sat, 06 Nov 2021 05:16:57 -0700 (PDT) MIME-Version: 1.0 References: <20211106104053.98761-1-ajaygargnsit@gmail.com> In-Reply-To: From: Ajay Garg Date: Sat, 6 Nov 2021 17:46:45 +0530 Message-ID: Subject: Re: [PATCH v2] tty: vt: keyboard: initialize "kbs" so that kfree(kbs) runs fine even if kbs is not kmalloced. To: Pavel Skripkin Cc: 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 Hi Pavel, Thanks for the review. > > Please, don't put change log into commit message. It should go under --- > Ok, many thanks Pavel. Will take care in all my future patches. > > These is only one caller of vt_do_kdgkb_ioctl, which simple does: > > > case KDGKBSENT: > case KDSKBSENT: > return vt_do_kdgkb_ioctl(cmd, up, perm); > > It means, that cmd can not be different from KDGKBSENT and KDSKBSENT. > > I guess, you found this "issue" via static analysis tool like smatch or > smth similar, but this bug is impossible right now. > Yes, following was reported by smatch (amongst others) : vt_do_kdgkb_ioctl() error: uninitialized symbol 'kbs'. Regarding the current state, "vt_do_kdgkb_ioctl" should ideally behave correctly independently, without bothering whether a cmd is a valid one. From that perspective, it makes sense to ensure that kfree never crashes. However, I don't have any strong opinions on what is right or what is wrong, as long as things work fine. So, if there is a general consensus that the change should not be made currently, I would be ok. In case the change should be made, kindly let me know, I will post the v3 patch (making change as per the review-comment of moving changelog below ---). Thanks and Regards, Ajay