| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When compiling with warnings (-Werror -W -Wall -Wunused
-Wunused-function) enabled we get:
rfs.c: In function ‘ipc_nv_data_md5_path_check’: rfs.c:115:17: error:
comparison of integer expressions of different signedness: ‘__off_t’
{aka ‘long int’} and ‘long unsigned int’ [-Werror=sign-compare]
if (st.st_size < 2 * sizeof(char) * MD5_DIGEST_LENGTH) {
^
This simplifies the comparison by making sure we have exactly 32
bytes (2*MD5_DIGEST_LENGTH, i.e. md5 digest in ascii) in the file we
read the MD5 digest from.
Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi>
Tested-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
Acked-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The way <> and "" are included are implementation defined according to
the C18 standard[1]:
A preprocessing directive of the form
# include < h-char-sequence > new-line
searches a sequence of implementation-defined places for a header
identified uniquely by the specified sequence between the < and >
delimiters, and causes the replacement of that directive by the entire
contents of the header. How the places are specified or the header
identified is implementation-defined.
A preprocessing directive of the form
# include " q-char-sequence " new-line
causes the replacement of that directive by the entire contents of the
source file identified by the specified sequence between the "
delimiters. The named source file is searched for in an
implementation-defined manner. If this search is not supported, or if
the search fails, the directive is reprocessed as if it read
And the GCC documentation has the following on #include directives[2]:
Both user and system header files are included using the preprocessing
directive ‘#include’. It has two variants:
#include <file>
This variant is used for system header files. It searches for a file
named file in a standard list of system directories. You can prepend
directories to this list with the -I option (see Invocation).
#include "file"
This variant is used for header files of your own program. It searches
for a file named file first in the directory containing the current
file, then in the quote directories and then the same directories used
for <file>. You can prepend directories to the list of quote
directories with the -iquote option.
References:
-----------
[1]The standard doesn't seem to be available for free, but the draft
can be downloaded from the following URL:
https://web.archive.org/web/20181230041359if_/http://www.open-std.org/jtc1/sc22/wg14/www/abq/c17_updated_proposed_fdis.pdf
[2]https://gcc.gnu.org/onlinedocs/cpp/Include-Syntax.html
Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This contains no functional changes.
The commented out code if any has also been preserved as it
could be relevant to the understanding of the code.
It will be kept until we understand why the code has been
commented. In that case we either need to remove it completely
or to replace it by a comment explaining why not having that
code was necessary.
For __FUNCTION__, according to checkpatch.pl, it's gcc
specific:
WARNING: __func__ should be used instead of gcc specific __FUNCTION__
However __func__ is part of the C18 standard[1]. In the
"6.4.2.2 Predefined identifiers" section, we have:
"The identifier __func__ shall be implicitly declared by
the translator as if, immediately following the opening
brace of each function definition, the declaration
static const char __func__[] = "function-name";
"
References:
-----------
[1]The standard doesn't seem to be available for free, but the draft
can be downloaded from the following URL:
https://web.archive.org/web/20181230041359if_/http://www.open-std.org/jtc1/sc22/wg14/www/abq/c17_updated_proposed_fdis.pdf
Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
Reviewed-by: Joonas Kylmälä <joonas.kylmala@iki.fi>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
With:
./configure CC=clang CFLAGS=-W -Wall -Wno-unused \
--no-create --no-recursion
we have:
rfs.c:86:20: warning: comparison of integers of
different signs: '__off_t' (aka 'long') and 'size_t'
(aka 'unsigned int') [-Wsign-compare]
if (st.st_size != size) {
~~~~~~~~~~ ^ ~~~~
rfs.c:146:20: warning: comparison of integers of
different signs: '__off_t' (aka 'long') and 'size_t'
(aka 'unsigned int') [-Wsign-compare]
if (st.st_size != size) {
~~~~~~~~~~ ^ ~~~~
This is caused by the following code:
size_t size;
[...]
rc = stat([...], &st);
if (st.st_size != size) {
[...]
}
However the type of size is wrong as the stat system call
returns a stat structure which has the following field:
off_t st_size; /* Total size, in bytes */
Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
|
|
|
|
| |
Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
|
|
|
|
|
|
|
| |
Without that, there are no ways to know the cause of failures with
ipc_nv_data_md5_calculate.
Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
|
|
|
|
| |
Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
|
|
|
|
| |
Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
|
|
|
|
| |
Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
|
|
|
|
| |
Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
|
|
|
|
| |
Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
|
|
|
|
| |
Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
|
|
|
|
| |
Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
|
|
|
|
| |
Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
|
|
|
|
| |
Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
|
|
|
|
| |
Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
|
|
|
|
| |
Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
|
|
|
|
| |
Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
|
|
|
|
| |
Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
|
|
|
|
|
| |
Change-Id: I00d93d54e5b9bc645c65a9bd72fb0b6edae822ad
Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
|
|
|
|
|
| |
Change-Id: I6d3745a75d6cb8ee945a4636fd6e6c2ff5ce4c66
Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
|
|
|
|
|
| |
Change-Id: I08cc4a5c404d1b513c56aa1eaeb68dfa6768a4e4
Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
|
|
|
|
|
| |
Change-Id: Ie393301a04523816e7aa674e57a4c3a2eb93247e
Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
|
|
|
|
|
| |
Change-Id: Idca5edb70869e07d35744301b185df02e42f5b4c
Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
|
|
|
|
|
| |
Change-Id: Ie80159518b6d7d1a6422d3dc47a903eb7fdad6d8
Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
|
|
|
|
|
|
|
| |
Also some minor headers cosmetics.
Change-Id: Id2b988b118d956e91827b9b840e3f384424593ae
Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
nv_data:
* Reworked device-specific nv_data passthrough functions
* Moved default values in rfs.h
* Added more specific infos (size, chunk size, secret)
* Applied to xmm6260 device
gprs:
* Moved non-io-related gprs handlers to gprs_specs
* Applied to crespo, aries and xmm6260 devices
Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
|
|
|
|
| |
Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
|
|
|
|
| |
Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
|
| |
|
| |
|
| |
|
|
|
|
| |
This reverts commit b93b917a70a6c85bfa2bd3789989b90b2e530abf.
|
| |
|
| |
|
|
|
|
| |
directly
|
|
|
|
| |
message types
|
|
|
|
| |
Signed-off-by: Simon Busch <morphis@gravedo.de>
|
|
|