Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp507920imm; Wed, 3 Oct 2018 21:38:36 -0700 (PDT) X-Google-Smtp-Source: ACcGV62f/5z2xvgHnbLRCx4zBqPtkyltdirFW8wlrGONcuKQhvYEf4UasDsf7xaEQk+Gda0Ckh6B X-Received: by 2002:a63:3dcb:: with SMTP id k194-v6mr4083171pga.191.1538627916843; Wed, 03 Oct 2018 21:38:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538627916; cv=none; d=google.com; s=arc-20160816; b=0bBrcExoXr+F9VVO8lQAx0SNvfxWdC9jd9LHTuYzXFOhjITncyyn6hfforNHBiD2e7 9iPXLdeddSxam+PkVdrEu56GoV17KwZWHzOIK95Sv/nj9F61fAaxcUuLl9NrVBhQ27Ia r9fcMK/qQXMDJQlO0AtRzKB9gFW94/xHGslvog/tdNN6NRo0w6JyIwqBnvYsh/YEHLCB WPpFiihjpgdlzv5f0J4EX3tm0ocLusW0memBoh2nMv9CuD+ZiDYpc1XCFlJYvaIYmksq uYWu4FRyJMU6K6GZpaSAP8pzh8srdrsdxxM6qqaX2idLWg9Rk3v10kZZjPXDNtKz8HwG Wemg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=jQeE93VbbNfp3K7xt8jRqG4vlZUs03OTr7LfpQaa+tI=; b=RZUb/KTvssuajioU4jsiM7RQimlE958QXH5HMyk3Qc2HWevTHz/JyX6CKaLvr+gadg +mMVn90+yjaszI8I+9L/bhansb5U+aNaMUkVfH0+cnEM0rjtBIfn7fiZncdjZ6GwUB9c 0G/UYMhh7XZSw+a+I+iOZeu4M7oUMhb7j9hX49/ix1HwNG27VIK7+d7RaavaP6JfYz+A tquFrJELnJUfPMkfhLIBQpmKLDoxS5aer4OJ24zDzSm3XhiWk75u4oHgIFpRXYPVD5dm M90M6WTf1JDfdrHYzK0ByAmQk1YiRwNP5EXff0nga4mpJPf2h2MfyeWdVzwXPNxnNewt kyww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=MrkB5Xo+; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t8-v6si3060823pgj.212.2018.10.03.21.38.07; Wed, 03 Oct 2018 21:38:36 -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=@linaro.org header.s=google header.b=MrkB5Xo+; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727131AbeJDL3Z (ORCPT + 99 others); Thu, 4 Oct 2018 07:29:25 -0400 Received: from mail-pg1-f193.google.com ([209.85.215.193]:32929 "EHLO mail-pg1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726735AbeJDL3Z (ORCPT ); Thu, 4 Oct 2018 07:29:25 -0400 Received: by mail-pg1-f193.google.com with SMTP id y18-v6so2561419pge.0 for ; Wed, 03 Oct 2018 21:38:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=jQeE93VbbNfp3K7xt8jRqG4vlZUs03OTr7LfpQaa+tI=; b=MrkB5Xo+6Yg102g/uglJPmqxNterNLrQuqrdM5BZzzRdI2jh2RS5/4tSBXh/ThHNBv UdIxRW1p6+52bHapMMf3LIaer0KdMdbgxrizkJE8z9e1wtw6PjqoGuBT6uonkH9PDLaB Q57t7CrdeE1ITvJ+sdB7p/O1HWRwhc1ggFu4o= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=jQeE93VbbNfp3K7xt8jRqG4vlZUs03OTr7LfpQaa+tI=; b=gX8ksODCKPI6mPixa6vv0XpxeqaV1VDiBqXWBqUQP/cukk8zJjQNRDjNEKzeqT+woM tqBiqDu8KMBXwjrJo1tjyCYCoYKDlsaRJJluFHIB+KTaZmdM6e7bYyjF2qcek7JooXN0 9BC1FKpTL9FwyNAcNfP7252ywJ5aJq6Uw/y7AdSjdcM4xMD9GJdwOx3PgHIU8GgdltXH zlRHhLhYJb9S27aoVg/mVj2J/rySeRnc3A303eUegUe5npaR/R7ZXcxXIFH9W/OaAsDR Ahufqjw+E8bav9BcA1mJZIFj1cp3a1zBv9+3m/gJfRgsyXudJoz+bX76ImfLJP7GjC+x 3fcg== X-Gm-Message-State: ABuFfogvffn+NCeTQX9p8UsSYXFXA3+mMKlk45v3LznZn8wTEAICb3p8 IsTQcGVW1x0F9JXdT6+SNHHJwA== X-Received: by 2002:a63:9a19:: with SMTP id o25-v6mr4104517pge.440.1538627882126; Wed, 03 Oct 2018 21:38:02 -0700 (PDT) Received: from tuxbook-pro (104-188-17-28.lightspeed.sndgca.sbcglobal.net. [104.188.17.28]) by smtp.gmail.com with ESMTPSA id f25-v6sm4239847pfn.177.2018.10.03.21.38.00 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 03 Oct 2018 21:38:01 -0700 (PDT) Date: Wed, 3 Oct 2018 21:37:59 -0700 From: Bjorn Andersson To: Arun Kumar Neelakantam Cc: davem@davemloft.net, clew@codeaurora.org, 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, Andy Gross , David Brown , "open list:ARM/QUALCOMM SUPPORT" Subject: Re: [PATCH] soc: qcom: qmi_interface: Limit txn ids to U16_MAX Message-ID: <20181004043759.GB1656@tuxbook-pro> References: <1538545205-17939-1-git-send-email-aneela@codeaurora.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1538545205-17939-1-git-send-email-aneela@codeaurora.org> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue 02 Oct 22:40 PDT 2018, Arun Kumar Neelakantam wrote: > 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 Reviewed-by: Bjorn Andersson Regards, Bjorn > --- > 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 >