Skip to content

Commit 90870eb

Browse files
Flavio Ceolinnashif
Flavio Ceolin
authored andcommitted
entropy: Use proper flexible array
Use proper flexible array instead of a GNU extension. Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
1 parent cbb9613 commit 90870eb

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

drivers/entropy/entropy_nrf5.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#include <zephyr/drivers/entropy.h>
99
#include <zephyr/kernel.h>
1010
#include <zephyr/sys/atomic.h>
11+
#include <zephyr/sys/util.h>
1112
#include <soc.h>
1213
#include <hal/nrf_rng.h>
1314
#include <zephyr/irq.h>
@@ -76,7 +77,7 @@ struct rng_pool {
7677
uint8_t last;
7778
uint8_t mask;
7879
uint8_t threshold;
79-
uint8_t buffer[0];
80+
FLEXIBLE_ARRAY_DECLARE(uint8_t, buffer);
8081
};
8182

8283
#define RNG_POOL_DEFINE(name, len) uint8_t name[sizeof(struct rng_pool) + (len)]

drivers/entropy/entropy_smartbond.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#include <DA1469xAB.h>
1313
#include <zephyr/pm/device.h>
1414
#include <zephyr/pm/policy.h>
15+
#include <zephyr/sys/util.h>
1516

1617
#include <zephyr/logging/log.h>
1718
LOG_MODULE_REGISTER(smartbond_entropy, CONFIG_ENTROPY_LOG_LEVEL);
@@ -27,7 +28,7 @@ struct rng_pool {
2728
uint8_t last;
2829
uint8_t mask;
2930
uint8_t threshold;
30-
uint8_t buffer[0];
31+
FLEXIBLE_ARRAY_DECLARE(uint8_t, buffer);
3132
};
3233

3334
#define RNG_POOL_DEFINE(name, len) uint8_t name[sizeof(struct rng_pool) + (len)]

drivers/entropy/entropy_stm32.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ struct rng_pool {
6565
uint8_t last;
6666
uint8_t mask;
6767
uint8_t threshold;
68-
uint8_t buffer[0];
68+
FLEXIBLE_ARRAY_DECLARE(uint8_t, buffer);
6969
};
7070

7171
#define RNG_POOL_DEFINE(name, len) uint8_t name[sizeof(struct rng_pool) + (len)]

0 commit comments

Comments
 (0)