All a4l_sbinfo_t are handled in __a4l_fill_desc() as a contiguous array
and is stored as data in a4l_root_t. The old code allocated enough
memory when the device had at least two subdevices, but missed 8 bytes
(on ARM32), which is the difference between sizeof(a4l_root_t) and
sizeof(a4l_leaf_t).
---
lib/analogy/descriptor.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/lib/analogy/descriptor.c b/lib/analogy/descriptor.c
index bc4d7bd..fa8cf93 100644
--- a/lib/analogy/descriptor.c
+++ b/lib/analogy/descriptor.c
@@ -100,8 +100,9 @@ static inline a4l_leaf_t *a4l_leaf_get(a4l_leaf_t * lf,
static int __a4l_get_sbsize(int fd, a4l_desc_t * dsc)
{
unsigned int i, j, nb_chan, nb_rng;
+ /* all subdevice a4l_sbinfo_t are within one special leaf: the root */
int ret, res =
- dsc->nb_subd * (sizeof(a4l_sbinfo_t) + sizeof(a4l_leaf_t));
+ sizeof(a4l_root_t) + dsc->nb_subd * (sizeof(a4l_sbinfo_t));
for (i = 0; i < dsc->nb_subd; i++) {
--
1.9.1
--
_____________________________________________________________
R-S-I Elektrotechnik GmbH & Co. KG
Woelkestrasse 11
D-85301 Schweitenkirchen
Fon: +49 8444 9204-0
Fax: +49 8444 9204-50
www.rsi-elektrotechnik.de
_____________________________________________________________
Amtsgericht Ingolstadt - GmbH: HRB 191328 - KG: HRA 170363
Geschäftsführer: Dr.-Ing. Michael Sorg, Dipl.-Ing. Franz Sorg
USt-IdNr.: DE 128592548
_______________________________________________
Xenomai mailing list
[email protected]
https://xenomai.org/mailman/listinfo/xenomai