Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp2164608imm; Tue, 2 Oct 2018 22:41:02 -0700 (PDT) X-Google-Smtp-Source: ACcGV62Gg/NdXWyry3TzhtSt32pBXvyxgxeui9F7wZxhwRANEUrpXx7E5+uXOIxmZx20lZne0Yvz X-Received: by 2002:a17:902:8eca:: with SMTP id x10-v6mr20155973plo.336.1538545262502; Tue, 02 Oct 2018 22:41:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538545262; cv=none; d=google.com; s=arc-20160816; b=KDaPEMyjFS0ufAmLumS+A6A25jIjTP+7VpYg9DNmx3tvDKLy/sCRbaIlZeYKpA63E3 6rhv0OhF+SsJ1lXNh9G5u4xzLfkXuols8xblfH+8KnzFM1bqxppLL00sH4grE763gCSO 5LGEdrtShj0yFxxPS+FQaMIa+cN1j3SKMq8b6qGoVp848DhryY7Grm1VkLHX7BgB8T9R KMR44kMIEo6tDqGjgeQaulBPzUCvcJPJ4ZjwrHBENSKbNAb2D2bybO6j6d4J/2fwu5ac U0BazFVdzgP8aNu9wm7eyAS74T/BBpwIN3l4CB3EgaD1qcdOaj3ulGurGXCxnICWHrYB wO5Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dmarc-filter:dkim-signature:dkim-signature; bh=GYuuDlKMbZp0tJAA239SYdFd7W6E0sLEcpFhyTbTRiA=; b=eLzkmB6/Da9btnKiIIfGzoCWOfVa8xGtsz0F97HETX+iWu/7yDAW63UfmyC44Ltn/O hNOiIwEvbmEUB2BkbZyrnF+hxW8Y+6ZOl2Caow2xFXK8iN726XRTDenNv6PvxsQMt0QC f/5zasoB6o6WjijxIb6Hsq0GZ7zQuNTbp7p+4vVrxqOPOI+B8OTjCjaUS8RjQdt9v2SB w9MScRM565wQkVvn+ipc1r2S5sGftSEDiYB6srO0Q+LPIf5nKVrj3p5LSZLHhthNYMNE P5Z0PVPv84dqFFDF1UC1lDUc8m41iRAwqTsl4lvCWODCxMQw1649cknGh7+s72evBFnj guWw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=PTvGohUI; dkim=pass header.i=@codeaurora.org header.s=default header.b=LzlH4UXO; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g16-v6si263058pgi.329.2018.10.02.22.40.47; Tue, 02 Oct 2018 22:41:02 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=PTvGohUI; dkim=pass header.i=@codeaurora.org header.s=default header.b=LzlH4UXO; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727588AbeJCM1P (ORCPT + 99 others); Wed, 3 Oct 2018 08:27:15 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:45168 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727261AbeJCM1O (ORCPT ); Wed, 3 Oct 2018 08:27:14 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 5A4AF60C61; Wed, 3 Oct 2018 05:40:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1538545224; bh=jsjxrL3tweSVlWRKUmeXfJxlcUzqbT5q82fzNyNYPe8=; h=From:To:Cc:Subject:Date:From; b=PTvGohUIr+G+oXQmJ8pj6nnuDQWrph5e9id/HyBGWZoeMluNb/o5VRpZeUwVR4eIM cEbUmIhjTnPgdUQ5kEW5/yVe0zcL4SX5vrUSMO+dGWadj7Yxdn6mq3hzYk8hP625uZ eofruHi/LQ1ss68DKjcFmtb/Wu02syQkw7s6mPnw= X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on pdx-caf-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=ALL_TRUSTED,BAYES_00, DKIM_INVALID,DKIM_SIGNED autolearn=no autolearn_force=no version=3.4.0 Received: from aneelaka-linux.qualcomm.com (blr-c-bdr-fw-01_globalnat_allzones-outside.qualcomm.com [103.229.19.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: aneela@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id D30DC60C61; Wed, 3 Oct 2018 05:40:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1538545223; bh=jsjxrL3tweSVlWRKUmeXfJxlcUzqbT5q82fzNyNYPe8=; h=From:To:Cc:Subject:Date:From; b=LzlH4UXOIKY1ELzFQfb3Ta89Aj+AHi2VVzHs50BZDt+rEXKz+6R/P70tjSb5A4pzC fj9ZNsUQUIZPcjYVT5/panNAIPYqmKD8OMBoAHd3WhT/5Y+dPNHGSXk6/BMkI/CPHK aUyLmRGJpunvZsqwVLloQnX/Szn1u2UIXV/HgrR8= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org D30DC60C61 Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=aneela@codeaurora.org From: Arun Kumar Neelakantam To: davem@davemloft.net, bjorn.andersson@linaro.org, clew@codeaurora.org Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, fw@strlen.de, hannes@stressinduktion.org, dvlasenk@redhat.com, nicolas.dechesne@linaro.org, Arun Kumar Neelakantam , Andy Gross , David Brown , linux-soc@vger.kernel.org (open list:ARM/QUALCOMM SUPPORT) Subject: [PATCH] soc: qcom: qmi_interface: Limit txn ids to U16_MAX Date: Wed, 3 Oct 2018 11:10:02 +0530 Message-Id: <1538545205-17939-1-git-send-email-aneela@codeaurora.org> X-Mailer: git-send-email 1.9.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Txn IDs created up to INT_MAX cause overflow while storing the IDs in u16 type supported by QMI header. Limit the txn IDs max value to U16_MAX to avoid overflow. Signed-off-by: Arun Kumar Neelakantam --- drivers/soc/qcom/qmi_interface.c | 2 +- include/linux/soc/qcom/qmi.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/soc/qcom/qmi_interface.c b/drivers/soc/qcom/qmi_interface.c index 938ca41c..c239a28 100644 --- a/drivers/soc/qcom/qmi_interface.c +++ b/drivers/soc/qcom/qmi_interface.c @@ -318,7 +318,7 @@ int qmi_txn_init(struct qmi_handle *qmi, struct qmi_txn *txn, txn->dest = c_struct; mutex_lock(&qmi->txn_lock); - ret = idr_alloc_cyclic(&qmi->txns, txn, 0, INT_MAX, GFP_KERNEL); + ret = idr_alloc_cyclic(&qmi->txns, txn, 0, U16_MAX, GFP_KERNEL); if (ret < 0) pr_err("failed to allocate transaction id\n"); diff --git a/include/linux/soc/qcom/qmi.h b/include/linux/soc/qcom/qmi.h index f4de336..5efa2b6 100644 --- a/include/linux/soc/qcom/qmi.h +++ b/include/linux/soc/qcom/qmi.h @@ -166,7 +166,7 @@ struct qmi_ops { struct qmi_txn { struct qmi_handle *qmi; - int id; + u16 id; struct mutex lock; struct completion completion; -- The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project