linux-arm-msm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Olav Haugan <ohaugan@codeaurora.org>
To: Will Deacon <will.deacon@arm.com>
Cc: "mitchelh@codeaurora.org" <mitchelh@codeaurora.org>,
	"iommu@lists.linux-foundation.org"
	<iommu@lists.linux-foundation.org>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>,
	"linux-arm-msm@vger.kernel.org" <linux-arm-msm@vger.kernel.org>
Subject: Re: [PATCH v3 1/1] iommu/arm-smmu: Do not access non-existing S2CR registers
Date: Fri, 22 Aug 2014 16:56:23 -0700	[thread overview]
Message-ID: <53F7D8A7.4010508@codeaurora.org> (raw)
In-Reply-To: <20140822152215.GC17255@arm.com>

On 8/22/2014 8:22 AM, Will Deacon wrote:
> Hi Olav,
> 
> Some really minor comments, but this looks good.
> 
> On Tue, Aug 19, 2014 at 12:17:38AM +0100, Olav Haugan wrote:
>> The number of S2CR registers is not properly set when stream
>> matching is not supported. Fix this and add check that we do not try to
>> access outside of the number of S2CR regisrers.
>>
>> Signed-off-by: Olav Haugan <ohaugan@codeaurora.org>
>> ---
>>  drivers/iommu/arm-smmu.c | 24 +++++++++++++++++-------
>>  1 file changed, 17 insertions(+), 7 deletions(-)
>>
>> diff --git a/drivers/iommu/arm-smmu.c b/drivers/iommu/arm-smmu.c
>> index 9fd8754d..a050f7a 100644
>> --- a/drivers/iommu/arm-smmu.c
>> +++ b/drivers/iommu/arm-smmu.c
>> @@ -548,9 +548,16 @@ static int register_smmu_master(struct arm_smmu_device *smmu,
>>  	master->of_node			= masterspec->np;
>>  	master->cfg.num_streamids	= masterspec->args_count;
>>  
>> -	for (i = 0; i < master->cfg.num_streamids; ++i)
>> +	for (i = 0; i < master->cfg.num_streamids; ++i) {
>> +		if (!(smmu->features & ARM_SMMU_FEAT_STREAM_MATCH) &&
>> +		     (masterspec->args[i] >= smmu->num_mapping_groups)) {
> 
> Can we stick masterspec->args[i] into a loop-local streamid variable,
> please?
> 
>> +			dev_err(dev,
>> +				"stream ID for master device %s greater than maximum allowed (%d)\n",
>> +				masterspec->np->name, smmu->num_mapping_groups);
>> +			return -ENOSPC;
> 
> -ERANGE might be better.
> 

Sure, will post v4 with these changes.

Thanks,

Olav

-- 
The Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
hosted by The Linux Foundation

      reply	other threads:[~2014-08-22 23:56 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-18 23:17 [PATCH v3 1/1] iommu/arm-smmu: Do not access non-existing S2CR registers Olav Haugan
     [not found] ` <1408403858-16766-1-git-send-email-ohaugan-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2014-08-22 15:22   ` Will Deacon
2014-08-22 23:56     ` Olav Haugan [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=53F7D8A7.4010508@codeaurora.org \
    --to=ohaugan@codeaurora.org \
    --cc=iommu@lists.linux-foundation.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=mitchelh@codeaurora.org \
    --cc=will.deacon@arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).