URL: https://github.com/SSSD/sssd/pull/518
Author: fidencio
 Title: #518: PYSSS_MURMUR: Fix [-Wsign-compare] found by gcc
Action: opened

PR body:
"""
While building the project I've noticed the following warning:
../src/python/pysss_murmur.c: In function ‘py_murmurhash3’:
../src/python/pysss_murmur.c:50:25: warning: comparison between signed and 
unsigned integer expressions [-Wsign-compare]
         (size_t)key_len > input_len) {
                         ^

Previously we were comparing key_len(long) with the output of strlen(key)
(size_t), thus the (size_t) cast.

Currently, we can jut compare key_len with input_len without issues and
without the needed to the cast.

Issue has been introduced as part of 41454a64c7.

Signed-off-by: Fabiano Fidêncio <fiden...@redhat.com>
"""

To pull the PR as Git branch:
git remote add ghsssd https://github.com/SSSD/sssd
git fetch ghsssd pull/518/head:pr518
git checkout pr518
From b0f1d063d302978735aa05a1eb1f85117e5fb3af Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fabiano=20Fid=C3=AAncio?= <fiden...@redhat.com>
Date: Fri, 16 Feb 2018 14:05:19 +0100
Subject: [PATCH] PYSSS_MURMUR: Fix [-Wsign-compare] found by gcc
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

While building the project I've noticed the following warning:
../src/python/pysss_murmur.c: In function ‘py_murmurhash3’:
../src/python/pysss_murmur.c:50:25: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         (size_t)key_len > input_len) {
                         ^

Previously we were comparing key_len(long) with the output of strlen(key)
(size_t), thus the (size_t) cast.

Currently, we can jut compare key_len with input_len without issues and
without the needed to the cast.

Issue has been introduced as part of 41454a64c7.

Signed-off-by: Fabiano Fidêncio <fiden...@redhat.com>
---
 src/python/pysss_murmur.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/python/pysss_murmur.c b/src/python/pysss_murmur.c
index 8f1752a29..bcb2b8151 100644
--- a/src/python/pysss_murmur.c
+++ b/src/python/pysss_murmur.c
@@ -47,7 +47,7 @@ static PyObject * py_murmurhash3(PyObject *module, PyObject *args)
     }
 
     if (seed > UINT32_MAX || key_len > INT_MAX || key_len < 0 ||
-        (size_t)key_len > input_len) {
+        key_len > input_len) {
         PyErr_Format(PyExc_ValueError, "Invalid value\n");
         return NULL;
     }
_______________________________________________
sssd-devel mailing list -- sssd-devel@lists.fedorahosted.org
To unsubscribe send an email to sssd-devel-le...@lists.fedorahosted.org

Reply via email to