[Possible] minor bug in platform_write_dct()

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
cogoc_1937206
Level 4
Level 4
First like received

Hello,

I've been perusing the DCT code to get a better feel for how it works.  (My main concern was how/if backwards compatibility would be handled if, for example, the device was upgraded to v1.2 which added new DCT data, then downgraded back to v1.1.  Looks like this will be fine.)

Anyway, if I understand the code correctly, the data-length check at the beginning of platform_write_dct() isn't quite right.  It's currently:

    /* Check if the data is too big to write */

    if ( data_length + data_start_offset > ( PLATFORM_DCT_COPY1_END_ADDRESS - PLATFORM_DCT_COPY1_START_ADDRESS ) )

    {

        return -1;

    }

But I think it should be:

    /* Check if the data is too big to write */

    if ( sizeof(platform_dct_header_t) + data_length + data_start_offset > ( PLATFORM_DCT_COPY1_END_ADDRESS - PLATFORM_DCT_COPY1_START_ADDRESS ) )

    {

        return -1;

    }

More generally -- is this the place you'd like people to be submitting bug reports?

Cheers!

0 Likes
1 Reply