Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp228734imu; Thu, 8 Nov 2018 18:28:47 -0800 (PST) X-Google-Smtp-Source: AJdET5dLWgq+PPfiHh8t3024RcLl2AjIIzM/rjzjHjT7e2nUDPTZ+ejNIEvLX9Ze4FbPSLvvMb9E X-Received: by 2002:a17:902:598f:: with SMTP id p15-v6mr6993941pli.260.1541730527933; Thu, 08 Nov 2018 18:28:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541730527; cv=none; d=google.com; s=arc-20160816; b=rmp53tAwUvcANgBPhvu+faoLxveABQsRfQucPbSmb2wKCBEtu3tXAISIfgzfrKZtGS sPvFSMPxGX6CoHn+lsoPLKIiheDBW/k3qtJXNZEOg4T/myyMJTODMX5XPGcsa9qxE6YX ZVIvovXj9B8zB2/8+MWlSNoO0ieX3XoHQlb+vO3HeKbyG6bTIDpgYEpwQl1FXSOCfR55 j/oFFChGi52X2ffvy+69yWm0GbLNYwyH+WWrL3MmGx9LiAdkxrQ1DqNSuf22cOoXH3GF meAEDwe2Jw7YTxtcFF1HR/67I7aQFJgJrANX0nLXUZKI6Xzlm/QHxtLxrcHGCa+cNjPg zdmQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature; bh=av8B9fXa40TdXDmMB/gn2NuaAc0FYClBRS+FIaCZczs=; b=yXZ8g8uvp4Ebb1DrJgWD5QbG0Z3eexhxBqxWP7gGQPJE7sGVrAmxSHYXqHHEZsgYHT MyePuXv1niWxiRL5shlOA7wMiDk0KBvld+BW/v++IQN2Vh2eKlDUQmKiPsOXJUvS/bFG 5H7b3+JyCQicNs+jHZmTS00MekivsmzVSC2wP7U/m1aOzEdkqOUrgBhXJMl5xDJv+4+Y ZDeY3wHhS2PsFUyQ3QunhifeDfUyaJTNXBD/rribP2W8qDs4VzwGUBGWMwhAG6w/obrG JLb26BvXHJKjJGY5NU3WnpG+QE6qQceQNJOkOxqXHh5ziHzEHLVnrI7bGjNELjdKFgAH MTUg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="cG0/ZKO1"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a11si4632830pga.198.2018.11.08.18.28.31; Thu, 08 Nov 2018 18:28:47 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="cG0/ZKO1"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727532AbeKIMGe (ORCPT + 99 others); Fri, 9 Nov 2018 07:06:34 -0500 Received: from mail-ot1-f67.google.com ([209.85.210.67]:45877 "EHLO mail-ot1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727255AbeKIMGe (ORCPT ); Fri, 9 Nov 2018 07:06:34 -0500 Received: by mail-ot1-f67.google.com with SMTP id g10so314716otl.12 for ; Thu, 08 Nov 2018 18:28:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=av8B9fXa40TdXDmMB/gn2NuaAc0FYClBRS+FIaCZczs=; b=cG0/ZKO1zqx3LiELe0VOfmiyr/oSB7nFepywC4tJ8SHKskNGarysJjYhUCw5rZ4Viu TIdIwJ5LU5R6oCkTFPk+NKqx5ygQS42RI0R4L4++oqAXJxTHu5wmECIU0Wi10Xl9bHP/ 5DNrMbIlvKfYKbzTti659irrplLSp3jri5At16bORVPZrSILMHzECtRBtzzf4UU/8SZa iel5irQTf6c7zqHDI5rPbqN0FRGur2XVU7VyGdckQT+eM6d5U1hb9jkG2V+8WxFSsa2P 8Fay/bPvZ5LYYR2pgiNIT3TqP+Z54u75n55dtdhbDvEtsUlj0RSJPXh9tjb9LyKjARxE IdBg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=av8B9fXa40TdXDmMB/gn2NuaAc0FYClBRS+FIaCZczs=; b=qWLgK6zu11vdQvlsRCJo5m5o891rR4f9cVvZhl98B9Tz3jkzmkQ3+TzubM+EIrSg0t PgEUGT2f2OK5FQV1qjTZSIxkwz2nACqdpT/AJc13CKFEOqRiPkaK48puN+exBX2Bmqox CBLA8/RALx9QqSXNS3A1myVdOF05xskuLOVca4csybzLrtBer4YgvZn+g+ruCPVxnvQl /6v98dLv+CSn6tdc+6S8qjN5LVMdmX/F1u6USaTfzfJSw91jjhNGxxIU7kMKLPF7foOt TDWYDYmwZr7IbyIAwAVe63n6Zd6k1FOWXi0HY6sKWqtDVkDvtzIPQCVJSm9wvBNxMvPZ SGSw== X-Gm-Message-State: AGRZ1gJg4Ub3dvrR9i4lCsLri4MjDgJW9uiexaDLe6Fv4pyZf9oh9SIZ uBL+w9kRlaLypOaDm17UHnaL7kXw X-Received: by 2002:a9d:4a5c:: with SMTP id d28mr4207340otj.25.1541730485653; Thu, 08 Nov 2018 18:28:05 -0800 (PST) Received: from simulacrum.agostinelli.home.saggio.net (cpe-66-68-97-1.austin.res.rr.com. [66.68.97.1]) by smtp.gmail.com with ESMTPSA id v40sm2334565oti.53.2018.11.08.18.28.04 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 08 Nov 2018 18:28:04 -0800 (PST) From: "Darryl T. Agostinelli" To: linux-mm@kvack.org Cc: cl@linux.com, bvanassche@acm.org, akpm@linux-foundation.org, penberg@kernel.org, vbabka@suse.cz, rientjes@google.com, iamjoonsoo.kim@lge.com, linux-kernel@vger.kernel.org, "Darryl T. Agostinelli" Subject: [PATCH] Suppress the sparse warning ./include/linux/slab.h:332:43: warning: dubious: x & !y Date: Thu, 8 Nov 2018 20:28:01 -0600 Message-Id: <20181109022801.29979-1-dagostinelli@gmail.com> X-Mailer: git-send-email 2.17.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Signed-off-by: Darryl T. Agostinelli --- include/linux/slab.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/include/linux/slab.h b/include/linux/slab.h index 918f374e7156..883b7f56bf35 100644 --- a/include/linux/slab.h +++ b/include/linux/slab.h @@ -317,6 +317,7 @@ static __always_inline enum kmalloc_cache_type kmalloc_type(gfp_t flags) int is_dma = 0; int type_dma = 0; int is_reclaimable; + int y; #ifdef CONFIG_ZONE_DMA is_dma = !!(flags & __GFP_DMA); @@ -329,7 +330,10 @@ static __always_inline enum kmalloc_cache_type kmalloc_type(gfp_t flags) * If an allocation is both __GFP_DMA and __GFP_RECLAIMABLE, return * KMALLOC_DMA and effectively ignore __GFP_RECLAIMABLE */ - return type_dma + (is_reclaimable & !is_dma) * KMALLOC_RECLAIM; + + y = (is_reclaimable & (is_dma == 0 ? 1 : 0)); + + return type_dma + y * KMALLOC_RECLAIM; } /* -- 2.17.1