Skip to contentSkip to conversation

dmaengine: ti: k3-udma: Use struct_size() in kzalloc()

PATCH In review Gustavo A. R. Silva 5 participants 12 messages Jun 19, 2020 – Jul 15, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 dmaengine: ti: k3-udma: Use struct_size() in kzalloc()

Make use of the struct_size() helper instead of an open-coded version in order to avoid any potential type mistakes.

This code was detected with the help of Coccinelle and, audited and fixed manually.

Addresses-KSPP-ID: https://github.com/KSPP/linux/issues/83

---
 drivers/dma/ti/k3-udma.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/dma/ti/k3-udma.c +2 -2
index 0d5fb154b8e2..411c54b86ba8 100644
@@ -2209,7 +2209,7 @@ udma_prep_slave_sg_pkt(struct udma_chan *uc, struct scatterlist *sgl,
 	u32 ring_id;
 	unsigned int i;
 
-	d = kzalloc(sizeof(*d) + sglen * sizeof(d->hwdesc[0]), GFP_NOWAIT);
+	d = kzalloc(struct_size(d, hwdesc, sglen), GFP_NOWAIT);
 	if (!d)
 		return NULL;
 
@@ -2525,7 +2525,7 @@ udma_prep_dma_cyclic_pkt(struct udma_chan *uc, dma_addr_t buf_addr,
 	if (period_len >= SZ_4M)
 		return NULL;
 
-	d = kzalloc(sizeof(*d) + periods * sizeof(d->hwdesc[0]), GFP_NOWAIT);
+	d = kzalloc(struct_size(d, hwdesc, periods), GFP_NOWAIT);
 	if (!d)
 		return NULL;
 
Signature · 1 line
2.27.0
maintainer
#1 lore raw
Quoted 17 lines · Gustavo A. R. Silva

Make use of the struct_size() helper instead of an open-coded version in order to avoid any potential type mistakes.

This code was detected with the help of Coccinelle and, audited and fixed manually.

Addresses-KSPP-ID: https://github.com/KSPP/linux/issues/83

---
 drivers/dma/ti/k3-udma.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/dma/ti/k3-udma.c +0 -0
index 0d5fb154b8e2..411c54b86ba8 100644

drivers/dma/ti/k3-udma.c udma_prep_slave_sg_pkt(struct udma_chan *uc, struct scatterlist *sgl, · line 2212

Quoted 5 lines
drivers/dma/ti/k3-udma.c +1 -1
@@ -2209,7 +2209,7 @@ udma_prep_slave_sg_pkt(struct udma_chan *uc, struct scatterlist *sgl,
 	u32 ring_id;
 	unsigned int i;
 
-	d = kzalloc(sizeof(*d) + sglen * sizeof(d->hwdesc[0]), GFP_NOWAIT);
+	d = kzalloc(struct_size(d, hwdesc, sglen), GFP_NOWAIT);

struct_size() is a * b + c but here we need, a + b * c.. the trailing struct is N times here..

Quoted 14 lines
drivers/dma/ti/k3-udma.c +1 -1
 	if (!d)
 		return NULL;
 
@@ -2525,7 +2525,7 @@ udma_prep_dma_cyclic_pkt(struct udma_chan *uc, dma_addr_t buf_addr,
 	if (period_len >= SZ_4M)
 		return NULL;
 
-	d = kzalloc(sizeof(*d) + periods * sizeof(d->hwdesc[0]), GFP_NOWAIT);
+	d = kzalloc(struct_size(d, hwdesc, periods), GFP_NOWAIT);
 	if (!d)
 		return NULL;
 
Signature · 1 line
2.27.0
Signature · 1 line
~Vinod
#2 lore raw
Quoted 8 lines · Vinod Koul
Quoted 7 lines · Gustavo A. R. Silva

Make use of the struct_size() helper instead of an open-coded version in order to avoid any potential type mistakes.

This code was detected with the help of Coccinelle and, audited and fixed manually.

Addresses-KSPP-ID: https://github.com/KSPP/linux/issues/83

Is this odd tag really useful?

Quoted 34 lines
Quoted 10 lines
---
 drivers/dma/ti/k3-udma.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/dma/ti/k3-udma.c +0 -0
index 0d5fb154b8e2..411c54b86ba8 100644

drivers/dma/ti/k3-udma.c udma_prep_slave_sg_pkt(struct udma_chan *uc, struct scatterlist *sgl, · line 2212

Quoted 5 lines
drivers/dma/ti/k3-udma.c +1 -1
@@ -2209,7 +2209,7 @@ udma_prep_slave_sg_pkt(struct udma_chan *uc, struct scatterlist *sgl,
 	u32 ring_id;
 	unsigned int i;
 
-	d = kzalloc(sizeof(*d) + sglen * sizeof(d->hwdesc[0]), GFP_NOWAIT);
+	d = kzalloc(struct_size(d, hwdesc, sglen), GFP_NOWAIT);

struct_size() is a * b + c but here we need, a + b * c.. the trailing struct is N times here..

Quoted 14 lines
drivers/dma/ti/k3-udma.c +1 -1
 	if (!d)
 		return NULL;
 
@@ -2525,7 +2525,7 @@ udma_prep_dma_cyclic_pkt(struct udma_chan *uc, dma_addr_t buf_addr,
 	if (period_len >= SZ_4M)
 		return NULL;
 
-	d = kzalloc(sizeof(*d) + periods * sizeof(d->hwdesc[0]), GFP_NOWAIT);
+	d = kzalloc(struct_size(d, hwdesc, periods), GFP_NOWAIT);
 	if (!d)
 		return NULL;
 
Signature · 1 line
2.27.0
maintainer
#3 lore raw
Quoted 11 lines · Joe Perches
Quoted 8 lines · Vinod Koul
Quoted 7 lines · Gustavo A. R. Silva

Make use of the struct_size() helper instead of an open-coded version in order to avoid any potential type mistakes.

This code was detected with the help of Coccinelle and, audited and fixed manually.

Addresses-KSPP-ID: https://github.com/KSPP/linux/issues/83

Is this odd tag really useful?

Not at all :)

Signature · 1 line
~Vinod
#4 lore raw
In reply to Vinod Koul
Quoted 21 lines · Vinod Koul
Quoted 20 lines · Gustavo A. R. Silva

Make use of the struct_size() helper instead of an open-coded version in order to avoid any potential type mistakes.

This code was detected with the help of Coccinelle and, audited and fixed manually.

Addresses-KSPP-ID: https://github.com/KSPP/linux/issues/83

---
 drivers/dma/ti/k3-udma.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/dma/ti/k3-udma.c +0 -0
index 0d5fb154b8e2..411c54b86ba8 100644
@@ -2209,7 +2209,7 @@ udma_prep_slave_sg_pkt(struct udma_chan *uc, struct scatterlist *sgl,
 	u32 ring_id;
 	unsigned int i;
 
Quoted 5 lines

drivers/dma/ti/k3-udma.c udma_prep_slave_sg_pkt(struct udma_chan *uc, struct scatterlist *sgl, · line 2212

Quoted 2 lines
drivers/dma/ti/k3-udma.c +1 -1
-	d = kzalloc(sizeof(*d) + sglen * sizeof(d->hwdesc[0]), GFP_NOWAIT);
+	d = kzalloc(struct_size(d, hwdesc, sglen), GFP_NOWAIT);

struct_size() is a * b + c but here we need, a + b * c.. the trailing struct is N times here..

Yes, that's correct.

Quoted 9 lines
Quoted 9 lines
drivers/dma/ti/k3-udma.c +0 -0
 	if (!d)
 		return NULL;
 
@@ -2525,7 +2525,7 @@ udma_prep_dma_cyclic_pkt(struct udma_chan *uc, dma_addr_t buf_addr,
 	if (period_len >= SZ_4M)
 		return NULL;
 
Quoted 8 lines
Quoted 7 lines
drivers/dma/ti/k3-udma.c +1 -1
-	d = kzalloc(sizeof(*d) + periods * sizeof(d->hwdesc[0]), GFP_NOWAIT);
+	d = kzalloc(struct_size(d, hwdesc, periods), GFP_NOWAIT);
 	if (!d)
 		return NULL;
 
Signature · 1 line
2.27.0

- Péter

Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

#5 lore raw
In reply to Vinod Koul

Hi Vinod,

Quoted 21 lines · Vinod Koul
Quoted 20 lines · Gustavo A. R. Silva

Make use of the struct_size() helper instead of an open-coded version in order to avoid any potential type mistakes.

This code was detected with the help of Coccinelle and, audited and fixed manually.

Addresses-KSPP-ID: https://github.com/KSPP/linux/issues/83

---
 drivers/dma/ti/k3-udma.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/dma/ti/k3-udma.c +0 -0
index 0d5fb154b8e2..411c54b86ba8 100644
@@ -2209,7 +2209,7 @@ udma_prep_slave_sg_pkt(struct udma_chan *uc, struct scatterlist *sgl,
 	u32 ring_id;
 	unsigned int i;
 
Quoted 6 lines

drivers/dma/ti/k3-udma.c udma_prep_slave_sg_pkt(struct udma_chan *uc, struct scatterlist *sgl, · line 2212

Quoted 2 lines
drivers/dma/ti/k3-udma.c +1 -1
-	d = kzalloc(sizeof(*d) + sglen * sizeof(d->hwdesc[0]), GFP_NOWAIT);
+	d = kzalloc(struct_size(d, hwdesc, sglen), GFP_NOWAIT);

struct_size() is a * b + c but here we need, a + b * c.. the trailing struct is N times here..

struct_size() works exactly as expected in this case. :) Please, see:

include/linux/overflow.h:314:
314 #define struct_size(p, member, count) \
315 __ab_c_size(count, \
316 sizeof(*(p)->member) + __must_be_array((p)->member),\
317 sizeof(*(p)))
318

Thanks
--
Gustavo

Quoted 15 lines
Quoted 14 lines
drivers/dma/ti/k3-udma.c +1 -1
 	if (!d)
 		return NULL;
 
@@ -2525,7 +2525,7 @@ udma_prep_dma_cyclic_pkt(struct udma_chan *uc, dma_addr_t buf_addr,
 	if (period_len >= SZ_4M)
 		return NULL;
 
-	d = kzalloc(sizeof(*d) + periods * sizeof(d->hwdesc[0]), GFP_NOWAIT);
+	d = kzalloc(struct_size(d, hwdesc, periods), GFP_NOWAIT);
 	if (!d)
 		return NULL;
 
Signature · 1 line
2.27.0
#6 lore raw
Quoted 31 lines · Gustavo A. R. Silva

Hi Vinod,

Quoted 21 lines · Vinod Koul
Quoted 20 lines · Gustavo A. R. Silva

Make use of the struct_size() helper instead of an open-coded version in order to avoid any potential type mistakes.

This code was detected with the help of Coccinelle and, audited and fixed manually.

Addresses-KSPP-ID: https://github.com/KSPP/linux/issues/83

---
 drivers/dma/ti/k3-udma.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/dma/ti/k3-udma.c +0 -0
index 0d5fb154b8e2..411c54b86ba8 100644
@@ -2209,7 +2209,7 @@ udma_prep_slave_sg_pkt(struct udma_chan *uc, struct scatterlist *sgl,
 	u32 ring_id;
 	unsigned int i;
 
Quoted 6 lines

drivers/dma/ti/k3-udma.c udma_prep_slave_sg_pkt(struct udma_chan *uc, struct scatterlist *sgl, · line 2212

Quoted 2 lines
drivers/dma/ti/k3-udma.c +1 -1
-	d = kzalloc(sizeof(*d) + sglen * sizeof(d->hwdesc[0]), GFP_NOWAIT);
+	d = kzalloc(struct_size(d, hwdesc, sglen), GFP_NOWAIT);

struct_size() is a * b + c but here we need, a + b * c.. the trailing struct is N times here..

Quoted 8 lines

struct_size() works exactly as expected in this case. :) Please, see:

include/linux/overflow.h:314:
314 #define struct_size(p, member, count) \
315 __ab_c_size(count, \
316 sizeof(*(p)->member) + __must_be_array((p)->member),\
317 sizeof(*(p)))

True, struct_size is for this sort of things.

While looking it up in include/linux/overflow.h I have noticed your commit in linux-next, which adds flex_array_size()

The example in the commit message contradicts with what the helper does imho. To be correct it should have been:

struct something {
	size_t count;
	struct foo items[];
};

- struct something *instance;
+ struct something instance;

- instance = kmalloc(struct_size(instance, items, count), GFP_KERNEL);
+ instance.items = kmalloc(struct_size(instance, items, count), GFP_KERNEL); instance->count = count;
memcpy(instance->items, src, flex_array_size(instance, items, instance->count));

If I'm not mistaken..

Quoted 20 lines

Thanks
--
Gustavo

Quoted 15 lines
Quoted 14 lines
drivers/dma/ti/k3-udma.c +1 -1
 	if (!d)
 		return NULL;
 
@@ -2525,7 +2525,7 @@ udma_prep_dma_cyclic_pkt(struct udma_chan *uc, dma_addr_t buf_addr,
 	if (period_len >= SZ_4M)
 		return NULL;
 
-	d = kzalloc(sizeof(*d) + periods * sizeof(d->hwdesc[0]), GFP_NOWAIT);
+	d = kzalloc(struct_size(d, hwdesc, periods), GFP_NOWAIT);
 	if (!d)
 		return NULL;
 
Signature · 1 line
2.27.0

- Péter

Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

#7 lore raw

Hi Peter,

Please, see my comments below...

Quoted 43 lines · Peter Ujfalusi
Quoted 31 lines · Gustavo A. R. Silva

Hi Vinod,

Quoted 21 lines · Vinod Koul
Quoted 20 lines · Gustavo A. R. Silva

Make use of the struct_size() helper instead of an open-coded version in order to avoid any potential type mistakes.

This code was detected with the help of Coccinelle and, audited and fixed manually.

Addresses-KSPP-ID: https://github.com/KSPP/linux/issues/83

---
 drivers/dma/ti/k3-udma.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/dma/ti/k3-udma.c +0 -0
index 0d5fb154b8e2..411c54b86ba8 100644
@@ -2209,7 +2209,7 @@ udma_prep_slave_sg_pkt(struct udma_chan *uc, struct scatterlist *sgl,
 	u32 ring_id;
 	unsigned int i;
 
Quoted 6 lines

drivers/dma/ti/k3-udma.c udma_prep_slave_sg_pkt(struct udma_chan *uc, struct scatterlist *sgl, · line 2212

Quoted 2 lines
drivers/dma/ti/k3-udma.c +1 -1
-	d = kzalloc(sizeof(*d) + sglen * sizeof(d->hwdesc[0]), GFP_NOWAIT);
+	d = kzalloc(struct_size(d, hwdesc, sglen), GFP_NOWAIT);

struct_size() is a * b + c but here we need, a + b * c.. the trailing struct is N times here..

Quoted 8 lines

struct_size() works exactly as expected in this case. :) Please, see:

include/linux/overflow.h:314:
314 #define struct_size(p, member, count) \
315 __ab_c_size(count, \
316 sizeof(*(p)->member) + __must_be_array((p)->member),\
317 sizeof(*(p)))

Quoted 8 lines

True, struct_size is for this sort of things.

While looking it up in include/linux/overflow.h I have noticed your commit in linux-next, which adds flex_array_size()

The example in the commit message contradicts with what the helper

There is no contradiction here.

Quoted 7 lines

does imho. To be correct it should have been:

struct something {
	size_t count;
	struct foo items[];
};
Quoted 8 lines

- struct something *instance;
+ struct something instance;

- instance = kmalloc(struct_size(instance, items, count), GFP_KERNEL);
+ instance.items = kmalloc(struct_size(instance, items, count), GFP_KERNEL); instance->count = count;
memcpy(instance->items, src, flex_array_size(instance, items, instance->count));

This is all wrong. Please, double check how struct_size() works.

Thanks
--
Gustavo

Quoted 20 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
drivers/dma/ti/k3-udma.c +0 -0
 	if (!d)
 		return NULL;
 
@@ -2525,7 +2525,7 @@ udma_prep_dma_cyclic_pkt(struct udma_chan *uc, dma_addr_t buf_addr,
 	if (period_len >= SZ_4M)
 		return NULL;
 
Quoted 8 lines
Quoted 8 lines
Quoted 7 lines
drivers/dma/ti/k3-udma.c +1 -1
-	d = kzalloc(sizeof(*d) + periods * sizeof(d->hwdesc[0]), GFP_NOWAIT);
+	d = kzalloc(struct_size(d, hwdesc, periods), GFP_NOWAIT);
 	if (!d)
 		return NULL;
 
Signature · 1 line
2.27.0

- Péter

Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

#8 lore raw
Quoted 69 lines · Gustavo A. R. Silva

Hi Peter,

Please, see my comments below...

Quoted 43 lines · Peter Ujfalusi
Quoted 31 lines · Gustavo A. R. Silva

Hi Vinod,

Quoted 21 lines · Vinod Koul
Quoted 20 lines · Gustavo A. R. Silva

Make use of the struct_size() helper instead of an open-coded version in order to avoid any potential type mistakes.

This code was detected with the help of Coccinelle and, audited and fixed manually.

Addresses-KSPP-ID: https://github.com/KSPP/linux/issues/83

---
 drivers/dma/ti/k3-udma.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/dma/ti/k3-udma.c +0 -0
index 0d5fb154b8e2..411c54b86ba8 100644
@@ -2209,7 +2209,7 @@ udma_prep_slave_sg_pkt(struct udma_chan *uc, struct scatterlist *sgl,
 	u32 ring_id;
 	unsigned int i;
 
Quoted 6 lines

drivers/dma/ti/k3-udma.c udma_prep_slave_sg_pkt(struct udma_chan *uc, struct scatterlist *sgl, · line 2212

Quoted 2 lines
drivers/dma/ti/k3-udma.c +1 -1
-	d = kzalloc(sizeof(*d) + sglen * sizeof(d->hwdesc[0]), GFP_NOWAIT);
+	d = kzalloc(struct_size(d, hwdesc, sglen), GFP_NOWAIT);

struct_size() is a * b + c but here we need, a + b * c.. the trailing struct is N times here..

Quoted 8 lines

struct_size() works exactly as expected in this case. :) Please, see:

include/linux/overflow.h:314:
314 #define struct_size(p, member, count) \
315 __ab_c_size(count, \
316 sizeof(*(p)->member) + __must_be_array((p)->member),\
317 sizeof(*(p)))

Quoted 8 lines

True, struct_size is for this sort of things.

While looking it up in include/linux/overflow.h I have noticed your commit in linux-next, which adds flex_array_size()

The example in the commit message contradicts with what the helper

There is no contradiction here.

Quoted 10 lines

does imho. To be correct it should have been:

struct something {
	size_t count;
	struct foo items[];
};

- struct something *instance;
+ struct something instance;

Quoted 7 lines
Quoted 5 lines

- instance = kmalloc(struct_size(instance, items, count), GFP_KERNEL);
+ instance.items = kmalloc(struct_size(instance, items, count), GFP_KERNEL); instance->count = count;
memcpy(instance->items, src, flex_array_size(instance, items, instance->count));

This is all wrong. Please, double check how struct_size() works.

Yes, I got it mixed up, I know how struct_size works... For some reason I just overlooked it's use in the kmalloc().

Quoted 25 lines

Thanks
--
Gustavo

Quoted 20 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
drivers/dma/ti/k3-udma.c +0 -0
 	if (!d)
 		return NULL;
 
@@ -2525,7 +2525,7 @@ udma_prep_dma_cyclic_pkt(struct udma_chan *uc, dma_addr_t buf_addr,
 	if (period_len >= SZ_4M)
 		return NULL;
 
Quoted 8 lines
Quoted 8 lines
Quoted 7 lines
drivers/dma/ti/k3-udma.c +1 -1
-	d = kzalloc(sizeof(*d) + periods * sizeof(d->hwdesc[0]), GFP_NOWAIT);
+	d = kzalloc(struct_size(d, hwdesc, periods), GFP_NOWAIT);
 	if (!d)
 		return NULL;
 
Signature · 1 line
2.27.0

- Péter

Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

- Péter

Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

#9 lore raw

Hi all,

Friendly ping: who can take this, please?

Thanks
--
Gustavo

Quoted 114 lines · Peter Ujfalusi
Quoted 69 lines · Gustavo A. R. Silva

Hi Peter,

Please, see my comments below...

Quoted 43 lines · Peter Ujfalusi
Quoted 31 lines · Gustavo A. R. Silva

Hi Vinod,

Quoted 21 lines · Vinod Koul
Quoted 20 lines · Gustavo A. R. Silva

Make use of the struct_size() helper instead of an open-coded version in order to avoid any potential type mistakes.

This code was detected with the help of Coccinelle and, audited and fixed manually.

Addresses-KSPP-ID: https://github.com/KSPP/linux/issues/83

---
 drivers/dma/ti/k3-udma.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/dma/ti/k3-udma.c +0 -0
index 0d5fb154b8e2..411c54b86ba8 100644
@@ -2209,7 +2209,7 @@ udma_prep_slave_sg_pkt(struct udma_chan *uc, struct scatterlist *sgl,
 	u32 ring_id;
 	unsigned int i;
 
Quoted 6 lines

drivers/dma/ti/k3-udma.c udma_prep_slave_sg_pkt(struct udma_chan *uc, struct scatterlist *sgl, · line 2212

Quoted 2 lines
drivers/dma/ti/k3-udma.c +1 -1
-	d = kzalloc(sizeof(*d) + sglen * sizeof(d->hwdesc[0]), GFP_NOWAIT);
+	d = kzalloc(struct_size(d, hwdesc, sglen), GFP_NOWAIT);

struct_size() is a * b + c but here we need, a + b * c.. the trailing struct is N times here..

Quoted 8 lines

struct_size() works exactly as expected in this case. :) Please, see:

include/linux/overflow.h:314:
314 #define struct_size(p, member, count) \
315 __ab_c_size(count, \
316 sizeof(*(p)->member) + __must_be_array((p)->member),\
317 sizeof(*(p)))

Quoted 8 lines

True, struct_size is for this sort of things.

While looking it up in include/linux/overflow.h I have noticed your commit in linux-next, which adds flex_array_size()

The example in the commit message contradicts with what the helper

There is no contradiction here.

Quoted 10 lines

does imho. To be correct it should have been:

struct something {
	size_t count;
	struct foo items[];
};

- struct something *instance;
+ struct something instance;

Quoted 7 lines
Quoted 5 lines

- instance = kmalloc(struct_size(instance, items, count), GFP_KERNEL);
+ instance.items = kmalloc(struct_size(instance, items, count), GFP_KERNEL); instance->count = count;
memcpy(instance->items, src, flex_array_size(instance, items, instance->count));

This is all wrong. Please, double check how struct_size() works.

Yes, I got it mixed up, I know how struct_size works... For some reason I just overlooked it's use in the kmalloc().

Quoted 25 lines

Thanks
--
Gustavo

Quoted 20 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
drivers/dma/ti/k3-udma.c +0 -0
 	if (!d)
 		return NULL;
 
@@ -2525,7 +2525,7 @@ udma_prep_dma_cyclic_pkt(struct udma_chan *uc, dma_addr_t buf_addr,
 	if (period_len >= SZ_4M)
 		return NULL;
 
Quoted 8 lines
Quoted 8 lines
Quoted 7 lines
drivers/dma/ti/k3-udma.c +1 -1
-	d = kzalloc(sizeof(*d) + periods * sizeof(d->hwdesc[0]), GFP_NOWAIT);
+	d = kzalloc(struct_size(d, hwdesc, periods), GFP_NOWAIT);
 	if (!d)
 		return NULL;
 
Signature · 1 line
2.27.0

- Péter

Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

- Péter

Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

maintainer
#10 lore raw
Quoted 3 lines · Gustavo A. R. Silva

Hi all,

Friendly ping: who can take this, please?

Applied now

Signature · 1 line
~Vinod
#11 lore raw
Quoted 7 lines · Vinod Koul
Quoted 3 lines · Gustavo A. R. Silva

Hi all,

Friendly ping: who can take this, please?

Applied now

Thanks, Vinod.

--
Gustavo