All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mmc: queue: allocate the scatterlist with a correct value
@ 2016-05-04  5:31 Jaehoon Chung
  2016-05-04  6:29 ` Adrian Hunter
  0 siblings, 1 reply; 3+ messages in thread
From: Jaehoon Chung @ 2016-05-04  5:31 UTC (permalink / raw)
  To: linux-mmc; +Cc: ulf.hansson, adrian.hunter, shawn.lin, Jaehoon Chung

If host->max is lower than PAGE_CACHE_SIZE, it should allocate
the scatterlist with incorrect size.
To prevent illegal behavior, fixed the scatterlist size for mmc_alloc_sg().

Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
---
 drivers/mmc/card/queue.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/mmc/card/queue.c b/drivers/mmc/card/queue.c
index 6f4323c..0353f99 100644
--- a/drivers/mmc/card/queue.c
+++ b/drivers/mmc/card/queue.c
@@ -276,12 +276,14 @@ int mmc_init_queue(struct mmc_queue *mq, struct mmc_card *card,
 		blk_queue_max_segments(mq->queue, host->max_segs);
 		blk_queue_max_segment_size(mq->queue, host->max_seg_size);
 
-		mqrq_cur->sg = mmc_alloc_sg(host->max_segs, &ret);
+		mqrq_cur->sg =
+			mmc_alloc_sg(mq->queue->limits.max_segments, &ret);
 		if (ret)
 			goto cleanup_queue;
 
 
-		mqrq_prev->sg = mmc_alloc_sg(host->max_segs, &ret);
+		mqrq_prev->sg =
+			mmc_alloc_sg(mq->queue->limits.max_segments, &ret);
 		if (ret)
 			goto cleanup_queue;
 	}
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] mmc: queue: allocate the scatterlist with a correct value
  2016-05-04  5:31 [PATCH] mmc: queue: allocate the scatterlist with a correct value Jaehoon Chung
@ 2016-05-04  6:29 ` Adrian Hunter
  2016-05-04  6:35   ` Jaehoon Chung
  0 siblings, 1 reply; 3+ messages in thread
From: Adrian Hunter @ 2016-05-04  6:29 UTC (permalink / raw)
  To: Jaehoon Chung, linux-mmc; +Cc: ulf.hansson, shawn.lin

On 04/05/16 08:31, Jaehoon Chung wrote:
> If host->max is lower than PAGE_CACHE_SIZE, it should allocate

host->max?

PAGE_CACHE_SIZE does not exist anymore.  Now there is only PAGE_SIZE.

> the scatterlist with incorrect size.

Don't understand what you mean.

> To prevent illegal behavior, fixed the scatterlist size for mmc_alloc_sg().
> 
> Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
> ---
>  drivers/mmc/card/queue.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/mmc/card/queue.c b/drivers/mmc/card/queue.c
> index 6f4323c..0353f99 100644
> --- a/drivers/mmc/card/queue.c
> +++ b/drivers/mmc/card/queue.c
> @@ -276,12 +276,14 @@ int mmc_init_queue(struct mmc_queue *mq, struct mmc_card *card,
>  		blk_queue_max_segments(mq->queue, host->max_segs);

So now mq->queue->limits.max_segments == host->max_segs unless it was zero.

>  		blk_queue_max_segment_size(mq->queue, host->max_seg_size);
>  
> -		mqrq_cur->sg = mmc_alloc_sg(host->max_segs, &ret);
> +		mqrq_cur->sg =
> +			mmc_alloc_sg(mq->queue->limits.max_segments, &ret);

So that is the same unless host->max_segs is zero.

>  		if (ret)
>  			goto cleanup_queue;
>  
>  
> -		mqrq_prev->sg = mmc_alloc_sg(host->max_segs, &ret);
> +		mqrq_prev->sg =
> +			mmc_alloc_sg(mq->queue->limits.max_segments, &ret);
>  		if (ret)
>  			goto cleanup_queue;
>  	}
> 


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] mmc: queue: allocate the scatterlist with a correct value
  2016-05-04  6:29 ` Adrian Hunter
@ 2016-05-04  6:35   ` Jaehoon Chung
  0 siblings, 0 replies; 3+ messages in thread
From: Jaehoon Chung @ 2016-05-04  6:35 UTC (permalink / raw)
  To: Adrian Hunter, linux-mmc; +Cc: ulf.hansson, shawn.lin

On 05/04/2016 03:29 PM, Adrian Hunter wrote:
> On 04/05/16 08:31, Jaehoon Chung wrote:
>> If host->max is lower than PAGE_CACHE_SIZE, it should allocate
> 
> host->max?
> 
> PAGE_CACHE_SIZE does not exist anymore.  Now there is only PAGE_SIZE.
> 
>> the scatterlist with incorrect size.
> 
> Don't understand what you mean.

Sorry..I have checked the other thing. Discard this.

> 
>> To prevent illegal behavior, fixed the scatterlist size for mmc_alloc_sg().
>>
>> Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
>> ---
>>  drivers/mmc/card/queue.c | 6 ++++--
>>  1 file changed, 4 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/mmc/card/queue.c b/drivers/mmc/card/queue.c
>> index 6f4323c..0353f99 100644
>> --- a/drivers/mmc/card/queue.c
>> +++ b/drivers/mmc/card/queue.c
>> @@ -276,12 +276,14 @@ int mmc_init_queue(struct mmc_queue *mq, struct mmc_card *card,
>>  		blk_queue_max_segments(mq->queue, host->max_segs);
> 
> So now mq->queue->limits.max_segments == host->max_segs unless it was zero.
> 
>>  		blk_queue_max_segment_size(mq->queue, host->max_seg_size);
>>  
>> -		mqrq_cur->sg = mmc_alloc_sg(host->max_segs, &ret);
>> +		mqrq_cur->sg =
>> +			mmc_alloc_sg(mq->queue->limits.max_segments, &ret);
> 
> So that is the same unless host->max_segs is zero.
> 
>>  		if (ret)
>>  			goto cleanup_queue;
>>  
>>  
>> -		mqrq_prev->sg = mmc_alloc_sg(host->max_segs, &ret);
>> +		mqrq_prev->sg =
>> +			mmc_alloc_sg(mq->queue->limits.max_segments, &ret);
>>  		if (ret)
>>  			goto cleanup_queue;
>>  	}
>>
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 
> 


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-05-04  6:36 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-05-04  5:31 [PATCH] mmc: queue: allocate the scatterlist with a correct value Jaehoon Chung
2016-05-04  6:29 ` Adrian Hunter
2016-05-04  6:35   ` Jaehoon Chung

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.