Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp3440754rwb; Tue, 16 Aug 2022 03:09:00 -0700 (PDT) X-Google-Smtp-Source: AA6agR7WPEWEX4PGJY9OafN6scjpUqO2uqSv7AwU+5ARyHgfWbtxIVCu+p1GbIo122xttzc0j1dx X-Received: by 2002:a17:90b:1c89:b0:1f8:42dd:5ebb with SMTP id oo9-20020a17090b1c8900b001f842dd5ebbmr22535826pjb.246.1660644540726; Tue, 16 Aug 2022 03:09:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660644540; cv=none; d=google.com; s=arc-20160816; b=VSDnONQikaXQS+H3Hr47SSDWoA9yBri6qpU9xzV0CXt9akarFDtxy+IRK2mkk7jG1K lnyro55PnwhKVk9rDEg7VrJujo3DWrlKCZ/tKYFhaoF2rI8Ab9/y/YcTIQWrZ3CLwGoi wB+bmAijfrOUOyrXJTvCRWrpxrFFA6I8dXEkdlyQve/GiJHDKfVBkmhKJsxfxE7i8Q1w qDuly5/JrzCqTQ6OBEqVLByCgsCTiPis9yASGSnWjpnLmn/1L3oau4UuNB9Fk8iB2IPb ztQtgPS8grBAOGy/peHW3nzDFS6GVg1+3x7xHV3fHSbvjl6mgcAVYncvPcg+PNih7M3J jymQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from :dkim-signature; bh=nTDkzXP779v1onwYVpNERKCNAZl7uIj+G6XLFlu+OrI=; b=OghenWikwKBitb6pNLph75EA9vNESdzMfp4W2XF+fqZABWzn/FOaEuGEbkXUEUbm4A QL93xz7oXEiwcU4ZiKrvPr9vHy65ALJ8Wkbg+HBZHVddY4XsMmLUnrNtlSgnmb8sAFYb ZyBLLXpi83ak4HB2xFBQe066tKobfUvfY6FK1p8O69j74vUeItekj2Y3wiBL2ahqVa69 QsxRnXf+n+gOOotRoV/9YB4s9922b0zGUl809B01tS9BlfSdW0aKNQUQHj8ERT2ujXN0 qdtBQtaTKDplNmZGoMZbE/7GacdYGzfC5UiRTVHlUqf5ceEkfE4Y2QOCruwSO4LbDVXT CZOQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=oSWAgMmk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e71-20020a63694a000000b00408b873b681si12548214pgc.743.2022.08.16.03.08.50; Tue, 16 Aug 2022 03:09:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=oSWAgMmk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233832AbiHPJjz (ORCPT + 99 others); Tue, 16 Aug 2022 05:39:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54712 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233738AbiHPJj1 (ORCPT ); Tue, 16 Aug 2022 05:39:27 -0400 Received: from mailgw02.mediatek.com (unknown [210.61.82.184]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B437A6AA23; Tue, 16 Aug 2022 02:09:32 -0700 (PDT) X-UUID: 6fb4a6f92b5e4a0fbc338d31687428da-20220816 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Type:MIME-Version:Message-ID:Date:Subject:CC:To:From; bh=nTDkzXP779v1onwYVpNERKCNAZl7uIj+G6XLFlu+OrI=; b=oSWAgMmkVKiZo8o5UR6n0l424do7eFvU9EuczQRw3XA3tB/A5QPReVHH/xQ4LKtw8wajDzpaIHnk9QOLbY6q68m2C2U5cNG3oUgD5p0vdJL3CRixqhgPbeT6WmTg1snvUUNmkQCThpyXRLFyKGQgQ7mFGQxuAu9BdheNY2heBww=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.9,REQID:728d4889-b26d-42fa-ad8c-369e73d472fd,OB:0,LO B:0,IP:0,URL:0,TC:0,Content:-5,EDM:0,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_ Ham,ACTION:release,TS:-5 X-CID-META: VersionHash:3d8acc9,CLOUDID:badd73fd-9e71-4a0f-ba6b-417998daea35,C OID:IGNORED,Recheck:0,SF:nil,TC:nil,Content:0,EDM:-3,IP:nil,URL:0,File:nil ,Bulk:nil,QS:nil,BEC:nil,COL:0 X-UUID: 6fb4a6f92b5e4a0fbc338d31687428da-20220816 Received: from mtkmbs10n2.mediatek.inc [(172.21.101.183)] by mailgw02.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 388599243; Tue, 16 Aug 2022 17:09:25 +0800 Received: from mtkmbs11n1.mediatek.inc (172.21.101.186) by mtkmbs10n2.mediatek.inc (172.21.101.183) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.792.3; Tue, 16 Aug 2022 17:09:24 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkmbs11n1.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.792.15 via Frontend Transport; Tue, 16 Aug 2022 17:09:24 +0800 From: Will Shiu To: , , , , , CC: Subject: [PATCH 1/1] Pinctrl: Add in zero check Date: Tue, 16 Aug 2022 17:09:03 +0800 Message-ID: <20220816090903.19558-1-Will.Shiu@mediatek.com> X-Mailer: git-send-email 2.18.0 MIME-Version: 1.0 Content-Type: text/plain X-MTK: N X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_MSPIKE_H2,RDNS_NONE, SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE,UNPARSEABLE_RELAY autolearn=no 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-kernel@vger.kernel.org add in check of buffer offset to avoid the exception when input 0 size. Signed-off-by: Will Shiu --- drivers/pinctrl/pinmux.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/pinctrl/pinmux.c b/drivers/pinctrl/pinmux.c index f94d43b082d9..646dff591b21 100644 --- a/drivers/pinctrl/pinmux.c +++ b/drivers/pinctrl/pinmux.c @@ -689,6 +689,9 @@ static ssize_t pinmux_select(struct file *file, const char __user *user_buf, if (len > PINMUX_SELECT_MAX) return -ENOMEM; + if (len <= 0) + return -EINVAL; + buf = kzalloc(PINMUX_SELECT_MAX, GFP_KERNEL); if (!buf) return -ENOMEM; -- 2.18.0