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=-0.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED autolearn=no 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 CC3C1C3A5A6 for ; Thu, 29 Aug 2019 17:03:23 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 9FA842054F for ; Thu, 29 Aug 2019 17:03:23 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="taqg5Tzp"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="PAXO8ZbC" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9FA842054F Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=eGEZGAWYbHJDyyVFceawvdIc9lQ7nQooMxzK+LGZaCU=; b=taqg5Tzp/PhQLh d3FVPL7G8WEfhdixMh7GkOKNVXD/7cLhIKzP7tU6EXDo7a54MQ/DetMRh3TMWTY6HBmoOIL8rqbXf x5cxwdAG9KzPPS1xMmvKZ6rhG3Am5D2RXwV6S9gn+eYFdhgq7ZBZny6i+dwjFSXe+x4PKzhm+1c67 3Kpnbfcnh+etrYH0N9PltizCRVA0WPMmf9UQscgfrd6S8QNS8S7CLcNQUgpFdkDlyGAF00zaTVTJX z5eCNb2ubugDLG3//zGkdEJiV6YDGTeaNHaXFZEWDaLkDxztP6WfLtAumgsXQn+R6Iv4Ht98PsCP1 3l5tkxIm4ZZ8VbqPnvyQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1i3NpL-0006Uw-5Q; Thu, 29 Aug 2019 17:03:15 +0000 Received: from mail-pg1-x543.google.com ([2607:f8b0:4864:20::543]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1i3NpI-0006UL-JZ for linux-arm-kernel@lists.infradead.org; Thu, 29 Aug 2019 17:03:13 +0000 Received: by mail-pg1-x543.google.com with SMTP id n4so1917583pgv.2 for ; Thu, 29 Aug 2019 10:03:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=cT40aX1Rm158dXbZvg7FygLmkaJhPhVyHtqBmt7878E=; b=PAXO8ZbCVqCw0eVBICcj0380noufm8aJLcc22R6FQyST4NWgBmi93l2YHrrW8mL0Bi oytzULxOstEziMDvAjIC/na6bXjIH2Gbhn+UtLkEiHbSzC5zuigdjKWDl5IkU9KNaTHk vNXzdah4WS39Vp4NQH4N7miEiBLnAxdMrpmLI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=cT40aX1Rm158dXbZvg7FygLmkaJhPhVyHtqBmt7878E=; b=IRW1p4YMIO22FmYQBWjH80kQBLD85z+Ybnrg96/gnseY/uuI7IFpPNwN4l2zugRaDo WGiAZGccnPcLRJXoeNHRkqSBNYB6u5xFaa6uCELctXNxU9Q9Qe2/JFZLz1Knd7XLv4ux RV2qWlqdbEb3nEJENz6jQYXjLPb9o/dE9fUZDIoI7xdma2VKYe/QeSNcTeC9bGZl4BYF nP2fTO3IJx+KJVBK++0mFRyQ/G73JngzKysBrnG5phkA/yJau/lXhdfqjhvQoVzQnYT1 EfuPfuWy86oXoBxtJjFZVyGK9Z8354Tjcu9P8Et/ooNGvCggvhJj+qJCVuhKsPfmKcuf s7vw== X-Gm-Message-State: APjAAAXzUAwyKAny2fcRpIVTRmt+BZjpNr9j+fAIDM2Lnd3a5lTeCmEh hcFHCgn5VaeSkjEUwQ9fzMem0A== X-Google-Smtp-Source: APXvYqx/Q0fFZvZWabn6tcL2I8GORQH9uYo7dBQccjsc+OV6Z3702ta4szivlvQBDGAk0mtwjAaNUQ== X-Received: by 2002:a62:1a45:: with SMTP id a66mr13125850pfa.142.1567098191599; Thu, 29 Aug 2019 10:03:11 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id t9sm2671099pgj.89.2019.08.29.10.03.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Aug 2019 10:03:10 -0700 (PDT) Date: Thu, 29 Aug 2019 10:03:09 -0700 From: Kees Cook To: Mauro Carvalho Chehab Subject: Re: [PATCH 6/7] media: don't do an unsigned int with a 31 bit shift Message-ID: <201908291002.2F67F5ADA@keescook> References: <4a411ba155eb062b6575aba0824123c840806c0b.1566502743.git.mchehab+samsung@kernel.org> <1a78a757b37d2628312e1d56d7a741ba89d42a91.1566502743.git.mchehab+samsung@kernel.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1a78a757b37d2628312e1d56d7a741ba89d42a91.1566502743.git.mchehab+samsung@kernel.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190829_100312_673206_C61BB5BB X-CRM114-Status: GOOD ( 10.34 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kate Stewart , Kamil Debski , Hans Verkuil , Andrzej Hajda , "Lad, Prabhakar" , Bluecherry Maintainers , Krzysztof Kozlowski , Sylwester Nawrocki , Nathan Chancellor , Andrzej Pietrasiewicz , Anton Sviridenko , Ezequiel Garcia , Andrey Utkin , Antti Palosaari , Steve Longerbeam , Ismael Luceno , Linux Media Mailing List , linux-arm-msm@vger.kernel.org, Stanimir Varbanov , Jeongtae Park , linux-samsung-soc@vger.kernel.org, Jacek Anaszewski , Thomas Gleixner , Mauro Carvalho Chehab , Mike Isely , linux-arm-kernel@lists.infradead.org, Andy Walls , Richard Fontana , Greg Kroah-Hartman , Randy Dunlap , Andy Gross , Tomasz Figa , Paul Kocialkowski , Kyungmin Park , Boris Brezillon , Kukjin Kim , Sakari Ailus , Colin Ian King Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Thu, Aug 22, 2019 at 04:39:33PM -0300, Mauro Carvalho Chehab wrote: > Doing something like: > > i32 foo = 1, bar; > > bar = foo << 31; > > has an undefined behavior in C, as warned by cppcheck, as we're > shifting a signed integer. > > Instead, force the numbers to be unsigned, in order to solve this > issue. I also recommend using the BIT() macro, which does the ULing correctly, etc. i.e. instead of: - keyup = (gpio & ir->mask_keyup) ? 1 << 31 : 0; + keyup = (gpio & ir->mask_keyup) ? 1UL << 31 : 0; use: - keyup = (gpio & ir->mask_keyup) ? 1 << 31 : 0; + keyup = (gpio & ir->mask_keyup) ? BIT(31) : 0; -- Kees Cook _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel