2014-12-26 23:31:23

by Mariusz Skamra

[permalink] [raw]
Subject: [PATCH 1/2] tools: Fix comparison between signed and unsigned integer

len is non-negative here, so we can safely cast it to size_t.
---
tools/bluemoon.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/bluemoon.c b/tools/bluemoon.c
index c785472..0f32d63 100644
--- a/tools/bluemoon.c
+++ b/tools/bluemoon.c
@@ -767,7 +767,7 @@ static void analyze_firmware(const char *path)
printf("\n");


- if (len != le32_to_cpu(css->size) * 4) {
+ if ((size_t) len != le32_to_cpu(css->size) * 4) {
fprintf(stderr, "CSS.size does not match file length\n");
goto done;
}
--
1.9.1



2014-12-29 17:49:57

by Luiz Augusto von Dentz

[permalink] [raw]
Subject: Re: [PATCH 1/2] tools: Fix comparison between signed and unsigned integer

Hi Mariusz,

On Fri, Dec 26, 2014 at 9:31 PM, Mariusz Skamra
<[email protected]> wrote:
> len is non-negative here, so we can safely cast it to size_t.
> ---
> tools/bluemoon.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/bluemoon.c b/tools/bluemoon.c
> index c785472..0f32d63 100644
> --- a/tools/bluemoon.c
> +++ b/tools/bluemoon.c
> @@ -767,7 +767,7 @@ static void analyze_firmware(const char *path)
> printf("\n");
>
>
> - if (len != le32_to_cpu(css->size) * 4) {
> + if ((size_t) len != le32_to_cpu(css->size) * 4) {
> fprintf(stderr, "CSS.size does not match file length\n");
> goto done;
> }
> --
> 1.9.1

It seems this has been fixed already.


--
Luiz Augusto von Dentz

2014-12-29 17:49:19

by Luiz Augusto von Dentz

[permalink] [raw]
Subject: Re: [PATCH 2/2] Add missing format specifiers in src/error.c

Hi Mariusz,

On Fri, Dec 26, 2014 at 9:31 PM, Mariusz Skamra
<[email protected]> wrote:
> ---
> src/error.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/src/error.c b/src/error.c
> index a80c1ab..ae227b6 100644
> --- a/src/error.c
> +++ b/src/error.c
> @@ -40,7 +40,7 @@ DBusMessage *btd_error_invalid_args(DBusMessage *msg)
> DBusMessage *btd_error_invalid_args_str(DBusMessage *msg, const char *str)
> {
> return g_dbus_create_error(msg, ERROR_INTERFACE ".InvalidArguments",
> - str);
> + "%s", str);
> }
>
> DBusMessage *btd_error_busy(DBusMessage *msg)
> @@ -99,7 +99,8 @@ DBusMessage *btd_error_not_authorized(DBusMessage *msg)
>
> DBusMessage *btd_error_not_permitted(DBusMessage *msg, const char *str)
> {
> - return g_dbus_create_error(msg, ERROR_INTERFACE ".NotPermitted", str);
> + return g_dbus_create_error(msg, ERROR_INTERFACE ".NotPermitted",
> + "%s", str);
> }
>
> DBusMessage *btd_error_no_such_adapter(DBusMessage *msg)
> --
> 1.9.1

Applied, thanks.


--
Luiz Augusto von Dentz

2014-12-26 23:31:24

by Mariusz Skamra

[permalink] [raw]
Subject: [PATCH 2/2] Add missing format specifiers in src/error.c

---
src/error.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/error.c b/src/error.c
index a80c1ab..ae227b6 100644
--- a/src/error.c
+++ b/src/error.c
@@ -40,7 +40,7 @@ DBusMessage *btd_error_invalid_args(DBusMessage *msg)
DBusMessage *btd_error_invalid_args_str(DBusMessage *msg, const char *str)
{
return g_dbus_create_error(msg, ERROR_INTERFACE ".InvalidArguments",
- str);
+ "%s", str);
}

DBusMessage *btd_error_busy(DBusMessage *msg)
@@ -99,7 +99,8 @@ DBusMessage *btd_error_not_authorized(DBusMessage *msg)

DBusMessage *btd_error_not_permitted(DBusMessage *msg, const char *str)
{
- return g_dbus_create_error(msg, ERROR_INTERFACE ".NotPermitted", str);
+ return g_dbus_create_error(msg, ERROR_INTERFACE ".NotPermitted",
+ "%s", str);
}

DBusMessage *btd_error_no_such_adapter(DBusMessage *msg)
--
1.9.1