* [PATCH] iio: test : rescale: check null return of kunit_kmalloc
@ 2024-10-29 8:44 Pei Xiao
2024-10-29 20:55 ` [PATCH] iio: test: " Markus Elfring
0 siblings, 1 reply; 3+ messages in thread
From: Pei Xiao @ 2024-10-29 8:44 UTC (permalink / raw)
To: jic23, lars, linux-iio, linux-kernel; +Cc: xiongxin, xiaopeitux, Pei Xiao
kunit_kmalloc may fail, return might be NULL and will cause
NULL pointer dereference later.
Signed-off-by: Pei Xiao <xiaopei01@kylinos.cn>
---
drivers/iio/test/iio-test-rescale.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/iio/test/iio-test-rescale.c b/drivers/iio/test/iio-test-rescale.c
index 31ee55a6faed..11bfff6636a3 100644
--- a/drivers/iio/test/iio-test-rescale.c
+++ b/drivers/iio/test/iio-test-rescale.c
@@ -652,6 +652,8 @@ static void iio_rescale_test_scale(struct kunit *test)
int rel_ppm;
int ret;
+ KUNIT_ASSERT_NOT_ERR_OR_NULL(test, buff);
+
rescale.numerator = t->numerator;
rescale.denominator = t->denominator;
rescale.offset = t->offset;
@@ -681,6 +683,8 @@ static void iio_rescale_test_offset(struct kunit *test)
int values[2];
int ret;
+ KUNIT_ASSERT_NOT_ERR_OR_NULL(test, buff_off);
+
rescale.numerator = t->numerator;
rescale.denominator = t->denominator;
rescale.offset = t->offset;
--
2.34.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] iio: test: rescale: check null return of kunit_kmalloc
2024-10-29 8:44 [PATCH] iio: test : rescale: check null return of kunit_kmalloc Pei Xiao
@ 2024-10-29 20:55 ` Markus Elfring
2024-10-30 3:33 ` Pei Xiao
0 siblings, 1 reply; 3+ messages in thread
From: Markus Elfring @ 2024-10-29 20:55 UTC (permalink / raw)
To: Pei Xiao, linux-iio, Jonathan Cameron, Lars-Peter Clausen
Cc: linux-kernel, xiaopeitux, xiongxin
> kunit_kmalloc may fail, return might be NULL and will cause
> NULL pointer dereference later.
* Please choose an imperative wording for an improved change description.
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?h=v6.12-rc5#n94
* How do you think about to add any tags (like “Fixes” and “Cc”) accordingly?
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?h=v6.12-rc5#n145
Regards,
Markus
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] iio: test: rescale: check null return of kunit_kmalloc
2024-10-29 20:55 ` [PATCH] iio: test: " Markus Elfring
@ 2024-10-30 3:33 ` Pei Xiao
0 siblings, 0 replies; 3+ messages in thread
From: Pei Xiao @ 2024-10-30 3:33 UTC (permalink / raw)
To: Markus Elfring, linux-iio, Jonathan Cameron, Lars-Peter Clausen
Cc: Pei Xiao, linux-kernel, xiaopeitux
On 2024/10/30 04:55, Markus Elfring wrote:
>> kunit_kmalloc may fail, return might be NULL and will cause
>> NULL pointer dereference later.
>
> * Please choose an imperative wording for an improved change description.
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?h=v6.12-rc5#n94
>
> * How do you think about to add any tags (like “Fixes” and “Cc”) accordingly?
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?h=v6.12-rc5#n145
>
>
> Regards,
> Markus
Hi Markus,
Thanks for your help,I will modify the commit information and add Fixes.
Thanks!
Pei Xiao.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-10-30 3:33 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-29 8:44 [PATCH] iio: test : rescale: check null return of kunit_kmalloc Pei Xiao
2024-10-29 20:55 ` [PATCH] iio: test: " Markus Elfring
2024-10-30 3:33 ` Pei Xiao
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox