From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.4 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 57CD7C41514 for ; Fri, 23 Aug 2019 12:11:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2D5CF233FD for ; Fri, 23 Aug 2019 12:11:11 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b="UQHxIVwQ" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2405320AbfHWMLK (ORCPT ); Fri, 23 Aug 2019 08:11:10 -0400 Received: from lelv0143.ext.ti.com ([198.47.23.248]:52614 "EHLO lelv0143.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2403942AbfHWMLK (ORCPT ); Fri, 23 Aug 2019 08:11:10 -0400 Received: from fllv0035.itg.ti.com ([10.64.41.0]) by lelv0143.ext.ti.com (8.15.2/8.15.2) with ESMTP id x7NCA7of063660; Fri, 23 Aug 2019 07:10:07 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1566562207; bh=33v/B/ZJqA3blXO/RNp5dWHGOqZq1+rFXfXmdj5+Gds=; h=Date:From:To:CC:Subject:References:In-Reply-To; b=UQHxIVwQKzurgl2CECBwOQG7NM1InTkeNUfGSo/z0TGdBNxqcoKLm7TPWzmreURv2 QDPOdOE1YT846Id7C3NGPUwpbZ01PtnlpDOo30p5Jhddm/jo1TBUJbLSuAK5dvwGkH zOsfD1LRRPAdR6lP8Rx08uphXBi3hStfy8W2L+k0= Received: from DFLE112.ent.ti.com (dfle112.ent.ti.com [10.64.6.33]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x7NCA7r7088500 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 23 Aug 2019 07:10:07 -0500 Received: from DFLE106.ent.ti.com (10.64.6.27) by DFLE112.ent.ti.com (10.64.6.33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5; Fri, 23 Aug 2019 07:10:07 -0500 Received: from fllv0039.itg.ti.com (10.64.41.19) by DFLE106.ent.ti.com (10.64.6.27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5 via Frontend Transport; Fri, 23 Aug 2019 07:10:07 -0500 Received: from ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by fllv0039.itg.ti.com (8.15.2/8.15.2) with SMTP id x7NCA6x4092204; Fri, 23 Aug 2019 07:10:07 -0500 Date: Fri, 23 Aug 2019 07:12:05 -0500 From: Benoit Parrot To: Mauro Carvalho Chehab CC: Linux Media Mailing List , Mauro Carvalho Chehab , Hans Verkuil , Andy Walls , Bluecherry Maintainers , Anton Sviridenko , Andrey Utkin , Ismael Luceno , "Lad, Prabhakar" , Kyungmin Park , Sylwester Nawrocki , Kukjin Kim , Krzysztof Kozlowski , Laurent Pinchart , Thierry Reding , Jonathan Hunter , Kieran Bingham , Hyun Kwon , Michal Simek , Sakari Ailus , Greg Kroah-Hartman , Richard Fontana , Kate Stewart , Allison Randal , Thomas Gleixner , , , , , Subject: Re: [PATCH v2 5/7] media: use the BIT() macro Message-ID: <20190823121204.ze4m6m3dxevjpjp6@ti.com> References: <20190823000829.GN5027@pendragon.ideasonboard.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20171215 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Mauro Carvalho Chehab wrote on Fri [2019-Aug-23 06:47:30 -0300]: > As warned by cppcheck: > > [drivers/media/dvb-frontends/cx24123.c:434]: (error) Shifting signed 32-bit value by 31 bits is undefined behaviour > [drivers/media/pci/bt8xx/bttv-input.c:87]: (error) Shifting signed 32-bit value by 31 bits is undefined behaviour > [drivers/media/pci/bt8xx/bttv-input.c:98]: (error) Shifting signed 32-bit value by 31 bits is undefined behaviour > ... > [drivers/media/v4l2-core/v4l2-ioctl.c:1391]: (error) Shifting signed 32-bit value by 31 bits is undefined behaviour > > There are lots of places where we're doing 1 << 31. That's bad, > as, depending on the architecture, this has an undefined behavior. > > The BIT() macro is already prepared to handle this, so, let's > just switch all "1 << number" macros by BIT(number) at the header files > with has 1 << 31. > > Signed-off-by: Mauro Carvalho Chehab > --- > > v2: > As suggested by Laurent: > - Don't touch multi-bit masks > - remove explicit casts > For: drivers/media/platform/am437x/am437x-vpfe_regs.h drivers/media/platform/ti-vpe/vpe_regs.h Reviewed-by: Benoit Parrot