From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mailout1.w1.samsung.com ([210.118.77.11]:43003 "EHLO mailout1.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751156AbbFVOmn (ORCPT ); Mon, 22 Jun 2015 10:42:43 -0400 Message-id: <55881EDF.4070609@samsung.com> Date: Mon, 22 Jun 2015 16:42:39 +0200 From: Krzysztof Opasiak MIME-version: 1.0 To: Michal Nazarewicz , balbi@ti.com Cc: stable@vger.kernel.org, david.fisher1@synopsys.com, gregkh@linuxfoundation.org, andrzej.p@samsung.com, m.szyprowski@samsung.com, linux-usb@vger.kernel.org Subject: Re: [PATCH 5/5] usb: gadget: mass_storage: Send correct number of LUNs to host References: <1434979163-5942-1-git-send-email-k.opasiak@samsung.com> <1434979163-5942-6-git-send-email-k.opasiak@samsung.com> In-reply-to: Content-type: text/plain; charset=utf-8; format=flowed Content-transfer-encoding: 7bit Sender: stable-owner@vger.kernel.org List-ID: On 06/22/2015 04:34 PM, Michal Nazarewicz wrote: > On Mon, Jun 22 2015, Krzysztof Opasiak wrote: >> GET_MAX_LUN request should return number of realy created LUNs >> not the size of preallocated array. >> >> This patch changes fsg_common_set_nluns() to fsg_common_set_max_luns() >> which now only allocates an empty array for luns and set nluns >> to 0. While LUNS are create we simply count them and store result >> in nluns which is send later to host. >> >> Reported-by: David Fisher >> Signed-off-by: Krzysztof Opasiak > > At this point I would just change common->luns to be an array rather > than a pointer. This would remove need for max_luns all together. Sounds like a good idea and I also though about it but I gave up due to memory usage. Most legacy gadgets reduce size of allocated luns array to number of received luns in module params. Adding array with static size will make this impossible. If we may don't care about this ~80 bytes I will be happy make common->luns array as it simplifies the code. BR's -- Krzysztof Opasiak Samsung R&D Institute Poland Samsung Electronics -- To unsubscribe from this list: send the line "unsubscribe stable" in