All of lore.kernel.org
 help / color / mirror / Atom feed
From: Brian Gix <brian.gix@intel.com>
To: linux-bluetooth@vger.kernel.org
Cc: luiz.von.dentz@gmail.com, brian.gix@intel.com
Subject: [PATCH BlueZ 2/2] core: Fix signed vs unsigned compare
Date: Wed, 29 Jun 2022 12:44:32 -0700	[thread overview]
Message-ID: <20220629194432.20229-2-brian.gix@intel.com> (raw)
In-Reply-To: <20220629194432.20229-1-brian.gix@intel.com>

__time_t is not a portable data type, and can cause sign mismatch on
come compares.

Fixes:
  CC       src/bluetoothd-device.o
src/device.c: In function ‘device_is_name_resolve_allowed’:
src/device.c:4092:17: error: comparison of integer expressions of different signedness: ‘__time_t’ {aka ‘long int’} and ‘long unsigned int’ [-Werror=sign-compare]
  if (now.tv_sec >= device->name_resolve_failed_time +
                 ^~
cc1: all warnings being treated as errors
---
 src/device.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/device.c b/src/device.c
index 7b451e458..012d73583 100644
--- a/src/device.c
+++ b/src/device.c
@@ -4088,7 +4088,7 @@ bool device_is_name_resolve_allowed(struct btd_device *device)
 	/* now >= failed_time + name_request_retry_delay, meaning the
 	 * period of not sending name request is over.
 	 */
-	if (now.tv_sec >= device->name_resolve_failed_time +
+	if ((unsigned)now.tv_sec >= device->name_resolve_failed_time +
 					btd_opts.name_request_retry_delay)
 		return true;
 
-- 
2.36.1


  reply	other threads:[~2022-06-29 19:52 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-29 19:44 [PATCH BlueZ 1/2] core: make bt_uuid_hash() portable across archs Brian Gix
2022-06-29 19:44 ` Brian Gix [this message]
2022-06-29 21:07   ` [PATCH BlueZ 2/2] core: Fix signed vs unsigned compare Luiz Augusto von Dentz
2022-06-29 22:15 ` [BlueZ,1/2] core: make bt_uuid_hash() portable across archs bluez.test.bot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220629194432.20229-2-brian.gix@intel.com \
    --to=brian.gix@intel.com \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=luiz.von.dentz@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.