diff options
author | Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org> | 2020-12-01 16:30:30 +0100 |
---|---|---|
committer | Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org> | 2020-12-03 01:42:30 +0100 |
commit | 73b26ca046c7dc2a3de89079203159a0cae83807 (patch) | |
tree | d72f1447e09b0a9420c22b455abcc5f67d08842e /include/pwr.h | |
parent | 01491b14fd20917990d401ac21df2d861bb307d7 (diff) | |
download | hardware_replicant_libsamsung-ipc-replicant-6.0-0004-rc4.tar.gz hardware_replicant_libsamsung-ipc-replicant-6.0-0004-rc4.tar.bz2 hardware_replicant_libsamsung-ipc-replicant-6.0-0004-rc4.zip |
ipc_nv_data_md5_calculate: handle size mismatch betterreplicant-6.0-0004-rc4
Currently libsamsung-ipc assumes that the size of nv_data.bin
files are always 0x200000.
While it's supposed to be the case for all the devices we support,
it is still a good idea to make sure that a meaningful error message
is reported to the users of nv_data-md5.
For instance if we created an empty file of 1 kB with the following
command:
$ ddrescue -s 1k /dev/zero zero.img
and that we used nv_data-md5 on it:
$ ./tools/nv_data-md5 zero.img
[ipc] file_data_read: Error: rc < 0
[ipc] ipc_nv_data_md5_calculate failed: data is NULL
Calculating nv_data backup md5 failed
we had a completely meaningless error message.
With this patch the error message looks like that instead:
$ ./tools/nv_data-md5 zero.img
[ipc] ipc_nv_data_md5_calculate: Checking zero.img size failed:
requested size: 2097152, file size: 1000
Calculating nv_data backup md5 failed
Here users have at least a fighting chance of being able to understand
what is going wrong.
Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
Diffstat (limited to 'include/pwr.h')
0 files changed, 0 insertions, 0 deletions