Re: [PATCH 2/2] ASoC: simple-card: test memory allocation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




   	cconf     = devm_kcalloc(dev, li.conf, sizeof(*cconf),     GFP_KERNEL);
-	if (!dai_props || !dai_link || !dais)
+	if (!dai_props || !dai_link || !dais || !cconf)
   		return -ENOMEM;

It isn't mentioned on code, but, "li.conf" will be 0 if it was not DPCM case.
This means cconf NULL might be happen.


Humm, then don't call devm_kcalloc with a zero argument...
And if you keep this code, if li.conf is not zero you still have a
risk of memory allocation failure. the test should be

+	if (!dai_props || !dai_link || !dais || (!cconf && li.conf))

Yes, indeed.
Thank you for your feedback

Actually, I have few cleanup patches for simple-card/audio-graph
for v5.2, then, your patch and it will be conflict.
If you are OK, I can merge your patch on my patch-set with your
Signed-off-by (or Reported-by).
Is OK for you ? I will post it when -rc1 was released from Linus.

yes, that's fine. Thanks!
_______________________________________________
Alsa-devel mailing list
Alsa-devel@xxxxxxxxxxxxxxxx
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel



[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Pulse Audio]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux