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=-9.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT 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 3BA7DC33CA4 for ; Sat, 11 Jan 2020 09:57:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0A5DE2064C for ; Sat, 11 Jan 2020 09:57:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578736629; bh=NNw99yDgnomHEX/wiCHt4g48oPdJlqmY2MfUhjGVdfE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=k+cglNa8HZO5SWm/N5cd+QMENoe5U+v2CRiL9MB0R/RrKdUkzjvtBTJ59SR0+yHIK StLHxCiRvksxY35WjIgixTS4zuLo6ydDyfx2AYvikPmscGcfTBO8flT2sPcbxIb9Zx ZT3rxYn820tq7yKdiRncgyqIThDIhgraPt3qE/NE= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729150AbgAKJ5I (ORCPT ); Sat, 11 Jan 2020 04:57:08 -0500 Received: from mail.kernel.org ([198.145.29.99]:48988 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728808AbgAKJ5H (ORCPT ); Sat, 11 Jan 2020 04:57:07 -0500 Received: from localhost (unknown [62.119.166.9]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id BD0EC2064C; Sat, 11 Jan 2020 09:57:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578736626; bh=NNw99yDgnomHEX/wiCHt4g48oPdJlqmY2MfUhjGVdfE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hVGYQCZTAFdhmZH54lpZOY+X+nUwQiHyZuL7Nt2BTbZFiuEJ+d0q0H5D805+QzI/f 5ZVUbDa7OqrIO34BcEdGBTnsQAnqfPRkqnzIRdxC+AH1/JajwCneZ1o1vDk+BfFCf3 Sq839R9fYJ9Dk8vEG6DyUxdg8kKt02Zpj6DOkwyQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Phil Sutter , Pablo Neira Ayuso , Sasha Levin Subject: [PATCH 4.4 37/59] netfilter: uapi: Avoid undefined left-shift in xt_sctp.h Date: Sat, 11 Jan 2020 10:49:46 +0100 Message-Id: <20200111094845.609038605@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200111094835.417654274@linuxfoundation.org> References: <20200111094835.417654274@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Phil Sutter [ Upstream commit 164166558aacea01b99c8c8ffb710d930405ba69 ] With 'bytes(__u32)' being 32, a left-shift of 31 may happen which is undefined for the signed 32-bit value 1. Avoid this by declaring 1 as unsigned. Signed-off-by: Phil Sutter Signed-off-by: Pablo Neira Ayuso Signed-off-by: Sasha Levin --- include/uapi/linux/netfilter/xt_sctp.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/uapi/linux/netfilter/xt_sctp.h b/include/uapi/linux/netfilter/xt_sctp.h index 29287be696a2..788b77c347a0 100644 --- a/include/uapi/linux/netfilter/xt_sctp.h +++ b/include/uapi/linux/netfilter/xt_sctp.h @@ -40,19 +40,19 @@ struct xt_sctp_info { #define SCTP_CHUNKMAP_SET(chunkmap, type) \ do { \ (chunkmap)[type / bytes(__u32)] |= \ - 1 << (type % bytes(__u32)); \ + 1u << (type % bytes(__u32)); \ } while (0) #define SCTP_CHUNKMAP_CLEAR(chunkmap, type) \ do { \ (chunkmap)[type / bytes(__u32)] &= \ - ~(1 << (type % bytes(__u32))); \ + ~(1u << (type % bytes(__u32))); \ } while (0) #define SCTP_CHUNKMAP_IS_SET(chunkmap, type) \ ({ \ ((chunkmap)[type / bytes (__u32)] & \ - (1 << (type % bytes (__u32)))) ? 1: 0; \ + (1u << (type % bytes (__u32)))) ? 1: 0; \ }) #define SCTP_CHUNKMAP_RESET(chunkmap) \ -- 2.20.1