From patchwork Mon Jun 24 09:32:32 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guennadi Liakhovetski X-Patchwork-Id: 2769441 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 63295C0AB1 for ; Mon, 24 Jun 2013 09:32:39 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 313392014D for ; Mon, 24 Jun 2013 09:32:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id DA2EC20149 for ; Mon, 24 Jun 2013 09:32:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751251Ab3FXJce (ORCPT ); Mon, 24 Jun 2013 05:32:34 -0400 Received: from moutng.kundenserver.de ([212.227.17.9]:61175 "EHLO moutng.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751157Ab3FXJce (ORCPT ); Mon, 24 Jun 2013 05:32:34 -0400 Received: from axis700.grange (dslb-178-001-231-216.pools.arcor-ip.net [178.1.231.216]) by mrelayeu.kundenserver.de (node=mrbap3) with ESMTP (Nemesis) id 0MQODc-1UhGZx0KXU-00TpTd; Mon, 24 Jun 2013 11:32:33 +0200 Received: by axis700.grange (Postfix, from userid 1000) id 82DB240BB4; Mon, 24 Jun 2013 11:32:32 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by axis700.grange (Postfix) with ESMTP id 7A63240BB3; Mon, 24 Jun 2013 11:32:32 +0200 (CEST) Date: Mon, 24 Jun 2013 11:32:32 +0200 (CEST) From: Guennadi Liakhovetski X-X-Sender: lyakh@axis700.grange To: Linux Media Mailing List cc: Hans Verkuil Subject: [PATCH] V4L2: soc-camera: fix uninitialised use compiler warning Message-ID: MIME-Version: 1.0 X-Provags-ID: V02:K0:HPKGqHEIFjS4rmQWxc8yjFzzbyTHnlN1FAfC2gMxPYi q37tw2Y0U9/OVESvECFGIhcLAtlhlqwlUqj7X418Sl31GyxPfg wIsZXHFprXLTcg9pUTEymIspFes+yT2g6fbW6EDgi7/CICYQpe rNW42W6DLpQ0lb6uhu+hkprhap1Uao/T7HqRHvGXGyid2BB5ik PGYPkhEeVeQlKll1leVAB1Ls5XdylN1gWHfZ2t0609CEqENKgX OLdTYsm/GPlZ08zu6KajU7BRuNW/SNEiVDf5MTcJZAtH13Wn+7 mNg7ghrXXdT1dah6JuZjIukxGwLCxSTwMegfbndCLr6FANwLBh fr8Ie2oJr/IjmWrrohdjEk+gRUKyKDyZNwJCVx1K4IfkfiBQAf x/gWO0jh/iIGg== Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Spam-Status: No, score=-8.0 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP In scan_async_group() if the size parameter is negative, the sasd pointer will be used uninitialised: drivers/media/platform/soc_camera/soc_camera.c: In function "soc_camera_host_register": drivers/media/platform/soc_camera/soc_camera.c:1514:55: warning: "sasd" may be used uninitialized in this function [-Wmaybe-uninitialized] sasd->asd.match.i2c.adapter_id, sasd->asd.match.i2c.address); ^ drivers/media/platform/soc_camera/soc_camera.c:1464:34: note: "sasd" was declared here struct soc_camera_async_subdev *sasd; Fix this by making "size" and the array, from which it is assigned unsigned. Reported-by: Hans Verkuil Signed-off-by: Guennadi Liakhovetski Acked-by: Hans Verkuil --- Hi Hans. None of my 2 cross-compilers produce the above warning. Could you verify, that this fixes the warning, that you've seen? Thanks Guennadi drivers/media/platform/soc_camera/soc_camera.c | 2 +- include/media/sh_mobile_ceu.h | 2 +- include/media/soc_camera.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/media/platform/soc_camera/soc_camera.c b/drivers/media/platform/soc_camera/soc_camera.c index 2e47b51..2dd0e52 100644 --- a/drivers/media/platform/soc_camera/soc_camera.c +++ b/drivers/media/platform/soc_camera/soc_camera.c @@ -1459,7 +1459,7 @@ static int soc_camera_async_complete(struct v4l2_async_notifier *notifier) } static int scan_async_group(struct soc_camera_host *ici, - struct v4l2_async_subdev **asd, int size) + struct v4l2_async_subdev **asd, unsigned int size) { struct soc_camera_async_subdev *sasd; struct soc_camera_async_client *sasc; diff --git a/include/media/sh_mobile_ceu.h b/include/media/sh_mobile_ceu.h index 8937241..7f57056 100644 --- a/include/media/sh_mobile_ceu.h +++ b/include/media/sh_mobile_ceu.h @@ -23,7 +23,7 @@ struct sh_mobile_ceu_info { int max_height; struct sh_mobile_ceu_companion *csi2; struct v4l2_async_subdev **asd; /* Flat array, arranged in groups */ - int *asd_sizes; /* 0-terminated array pf asd group sizes */ + unsigned int *asd_sizes; /* 0-terminated array pf asd group sizes */ }; #endif /* __ASM_SH_MOBILE_CEU_H__ */ diff --git a/include/media/soc_camera.h b/include/media/soc_camera.h index 906ed98..34d2414 100644 --- a/include/media/soc_camera.h +++ b/include/media/soc_camera.h @@ -87,7 +87,7 @@ struct soc_camera_host { const char *drv_name; struct soc_camera_host_ops *ops; struct v4l2_async_subdev **asd; /* Flat array, arranged in groups */ - int *asd_sizes; /* 0-terminated array of asd group sizes */ + unsigned int *asd_sizes; /* 0-terminated array of asd group sizes */ }; struct soc_camera_host_ops {