From patchwork Sat Mar 7 21:25:28 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 3048 Return-Path: Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 853786193A for ; Sat, 7 Mar 2020 22:25:38 +0100 (CET) Received: from pendragon.bb.dnainternet.fi (81-175-216-236.bb.dnainternet.fi [81.175.216.236]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id B5D535F for ; Sat, 7 Mar 2020 22:25:37 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1583616338; bh=edz6y8KkVj7nP0TOTFF18hDFpEoZ1ounqq0qRV3Phc0=; h=From:To:Subject:Date:From; b=YKWnr7MzbX7PojaQOMMnXyfVpOP44PZO2uS9OQfrilDnPQmZmOFKrwKiyO3bM6i0T 8BPSM/D2WnkMPqiDD3mBOcbnrov+IreFiblmR+4/TZeYxEiO+u5pYZ/o7xJw2ZNckU Ts27O1E5bC4zZoC//z2s03YqYCR3eDagQesC0A8Q= From: Laurent Pinchart To: libcamera-devel@lists.libcamera.org Date: Sat, 7 Mar 2020 23:25:28 +0200 Message-Id: <20200307212530.28053-1-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.24.1 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH] v4l2: v4l2_camera_proxy: Fix sign compare compilation error X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Mar 2020 21:25:38 -0000 When compiling for ARM and uClibc, gcc-8.3.0 complains about comparison of integer expressions of different signedness: ../../src/v4l2/v4l2_camera_proxy.cpp: In member function ‘void* V4L2CameraProxy::mmap(void*, size_t, int, int, off_t)’: ../../src/v4l2/v4l2_camera_proxy.cpp:88:25: error: comparison of integer expressions of different signedness: ‘unsigned int’ and ‘off_t’ {aka ‘long int’} [-Werror=sign-compare] if (index * sizeimage_ != offset || length != sizeimage_) { ~~~~~~~~~~~~~~~~~~~^~~~~~~~~ Fix the compilation error with a cast. Signed-off-by: Laurent Pinchart Reviewed-by: Niklas Söderlund --- src/v4l2/v4l2_camera_proxy.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/v4l2/v4l2_camera_proxy.cpp b/src/v4l2/v4l2_camera_proxy.cpp index 622520479be0..b620f236499c 100644 --- a/src/v4l2/v4l2_camera_proxy.cpp +++ b/src/v4l2/v4l2_camera_proxy.cpp @@ -85,7 +85,8 @@ void *V4L2CameraProxy::mmap(void *addr, size_t length, int prot, int flags, } unsigned int index = offset / sizeimage_; - if (index * sizeimage_ != offset || length != sizeimage_) { + if (static_cast(index * sizeimage_) != offset || + length != sizeimage_) { errno = EINVAL; return MAP_FAILED; }