Patch Set 1:

(1 comment)

https://gerrit.osmocom.org/#/c/7572/1/src/osmo-bts-sysmo/eeprom.c
File src/osmo-bts-sysmo/eeprom.c:

Line 498:             err = eeprom_read( EEPROM_CFG_START_ADDR + 
((int)&ee.cfg.v1.sysInfo - (int)&ee), sizeof(ee.cfg.v1.sysInfo), (char 
*)&ee.cfg.v1.sysInfo );
> OK, I verified that this is the case by calling eeprom_read() twice in the 
Ok now I see the issue. According to C standard I read:

"""
6.5.6 Additive operators
....
9 When two pointers are subtracted, both shall point to elements of the same 
array object, or one past the last element of the array object; the result is 
the difference of the subscripts of the two array elements.
"""

So the substraction there when using pointers is giving us the difference in 
elements instead of the difference in bytes, and we ar eprobably interesting in 
counting bytes here.

So I think the correct fix in here would be to cast to (uint8_t*) instead.


-- 
To view, visit https://gerrit.osmocom.org/7572
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: Iaa7318387ad7bb248c261b1f428019244039e7d2
Gerrit-PatchSet: 1
Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Owner: Keith Whyte <[email protected]>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Keith Whyte <[email protected]>
Gerrit-Reviewer: Pau Espin Pedrol <[email protected]>
Gerrit-Reviewer: Vadim Yanitskiy <[email protected]>
Gerrit-HasComments: Yes

Reply via email to