osmo-bts: rach_ind.ra size

Neels Hofmeyr nhofmeyr at sysmocom.de
Mon Jul 25 10:22:34 UTC 2016


I just came across this compiler warning:

l1sap.c: In function 'gsmtap_ph_rach':
l1sap.c:291:8: warning: assignment from incompatible pointer type [enabled by default]
  *data = &l1sap->u.rach_ind.ra;
        ^

It's a
	uint16_t ra
and used like this in common/l1sap.c:

	static int gsmtap_ph_rach(struct osmo_phsap_prim *l1sap, uint8_t *chan_type,
		uint8_t *tn, uint8_t *ss, uint32_t *fn, uint8_t **data, int *len)
	{
	[...]
		*data = &l1sap->u.rach_ind.ra;
		*len = 1;

A cast like this would fix the compiler warning and make sense if data is
interpreted to point at a 16 bit data block, probably in host byte order
though:

		*data = (uint8_t*)&l1sap->u.rach_ind.ra;
		*len = 1;

But *len = 1 means that **data is an 8bit value?
This is sent to gsmtap.

Is *len = 1 something we should fix?

~Neels


-- 
- Neels Hofmeyr <nhofmeyr at sysmocom.de>          http://www.sysmocom.de/
=======================================================================
* sysmocom - systems for mobile communications GmbH
* Alt-Moabit 93
* 10559 Berlin, Germany
* Sitz / Registered office: Berlin, HRB 134158 B
* Geschäftsführer / Managing Directors: Harald Welte
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.osmocom.org/pipermail/openbsc/attachments/20160725/21a520fa/attachment-0001.bin>


More information about the OpenBSC mailing list