Sorry, I didn’t notice this reply before.
> On 06/22/2015 04:24 PM, Michal Nazarewicz wrote:
>> common->nluns is set to FSG_MAX_LUNS in fsg_alloc_inst (which is called
>> prior to fsg_alloc) so this is not an issue.
On Mon, Jun 22 2015, Krzysztof Opasiak wrote:
> True, but all legacy gadgets which use mass storage call
> fsg_common_set_nluns() after reading module parameters and after
> allocating function instance. As argument they pass number luns received
> in module params.
Right. As a quick fix I would propose doing:
----------- >8 ---------------------------------------------------------
diff --git a/drivers/usb/gadget/function/f_mass_storage.c
b/drivers/usb/gadget/function/f_mass_storage.c
index e1beb14..15c3071 100644
--- a/drivers/usb/gadget/function/f_mass_storage.c
+++ b/drivers/usb/gadget/function/f_mass_storage.c
@@ -2786,7 +2786,7 @@ int fsg_common_set_nluns(struct fsg_common *common, int
nluns)
return -EINVAL;
}
- curlun = kcalloc(nluns, sizeof(*curlun), GFP_KERNEL);
+ curlun = kcalloc(FSG_MAX_LUNS, sizeof(*curlun), GFP_KERNEL);
if (unlikely(!curlun))
return -ENOMEM;
----------- >8 ---------------------------------------------------------
Since I think we agreed that luns should just be turned into an array
with static length the above won’t be too far from that goal.
--
Best regards, _ _
.o. | Liege of Serenely Enlightened Majesty of o' \,=./ `o
..o | Computer Science, Michał “mina86” Nazarewicz (o o)
ooo +--<[email protected]>--<xmpp:[email protected]>--ooO--(_)--Ooo--
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html