From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752130AbdHCVqA (ORCPT ); Thu, 3 Aug 2017 17:46:00 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:45170 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751736AbdHCVp4 (ORCPT ); Thu, 3 Aug 2017 17:45:56 -0400 Date: Thu, 3 Aug 2017 14:45:55 -0700 From: Andrew Morton To: Matthias Kaehlcke Cc: zijun_hu , linux-kernel@vger.kernel.org, Doug Anderson , Nick Desaulniers , Greg Hackmann , Yury Norov , Ard Biesheuvel Subject: Re: [PATCH v2] bitops: Avoid integer overflow in GENMASK(_ULL) Message-Id: <20170803144555.facd691eef60a85bcc06b697@linux-foundation.org> In-Reply-To: <20170803212020.24939-1-mka@chromium.org> References: <20170803212020.24939-1-mka@chromium.org> X-Mailer: Sylpheed 3.4.1 (GTK+ 2.24.23; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 3 Aug 2017 14:20:20 -0700 Matthias Kaehlcke wrote: > GENMASK(_ULL) performs a left-shift of ~0UL(L), which technically > results in an integer overflow. clang raises a warning if the overflow > occurs in a preprocessor expression. That's just irritaing. > Clear the low-order bits through > a substraction instead of the left-shift to avoid the overflow. There's no change in .text size for a few files I tested so guess we can live with it.