From patchwork Mon Jun 27 08:26:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Huth X-Patchwork-Id: 1648793 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=hKSnhwLq; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=hKSnhwLq; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ozlabs.org (client-ip=2404:9400:2:0:216:3eff:fee1:b9f1; helo=lists.ozlabs.org; envelope-from=slof-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org; receiver=) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2404:9400:2:0:216:3eff:fee1:b9f1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4LWgn64whwz9sXM for ; Mon, 27 Jun 2022 18:26:50 +1000 (AEST) Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4LWgn52xX0z3btp for ; Mon, 27 Jun 2022 18:26:49 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=hKSnhwLq; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=hKSnhwLq; dkim-atps=neutral X-Original-To: slof@lists.ozlabs.org Delivered-To: slof@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=redhat.com (client-ip=170.10.133.124; helo=us-smtp-delivery-124.mimecast.com; envelope-from=thuth@redhat.com; receiver=) Authentication-Results: lists.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=hKSnhwLq; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=hKSnhwLq; dkim-atps=neutral Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4LWgmz4jnyz3bdy for ; Mon, 27 Jun 2022 18:26:41 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1656318396; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=bSOt6VVZ7B1NB+y0wy9p2BbIuQCT7DsKqT0JDUZcd7Y=; b=hKSnhwLqL00W7Z9pPQJedoVjKKFUhKt9jo5jY1m/Tx00sQRPJwzpKm+mzOjiEdneBW4ZeW McqP3kQDV5ffCS/PnFrWFzpPtK9AEBNtWmdn8XxnPIogK65FHznyJ12FqX7PyFEw1K5HdI Z96rXBTUP4rxmC9eLARt/FEzUuIOi+k= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1656318396; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=bSOt6VVZ7B1NB+y0wy9p2BbIuQCT7DsKqT0JDUZcd7Y=; b=hKSnhwLqL00W7Z9pPQJedoVjKKFUhKt9jo5jY1m/Tx00sQRPJwzpKm+mzOjiEdneBW4ZeW McqP3kQDV5ffCS/PnFrWFzpPtK9AEBNtWmdn8XxnPIogK65FHznyJ12FqX7PyFEw1K5HdI Z96rXBTUP4rxmC9eLARt/FEzUuIOi+k= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-202-jHvZbvA2NfuFY1Oik7NT1A-1; Mon, 27 Jun 2022 04:26:35 -0400 X-MC-Unique: jHvZbvA2NfuFY1Oik7NT1A-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id BD9FB80A0E4 for ; Mon, 27 Jun 2022 08:26:34 +0000 (UTC) Received: from thuth.com (unknown [10.39.192.150]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3F8CB1121314 for ; Mon, 27 Jun 2022 08:26:34 +0000 (UTC) From: Thomas Huth To: slof@lists.ozlabs.org Date: Mon, 27 Jun 2022 10:26:32 +0200 Message-Id: <20220627082632.25192-1-thuth@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=thuth@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Subject: [SLOF] [PATCH] lib/libnet/ipv6: Silence compiler warning from Clang X-BeenThere: slof@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Patches for https://github.com/aik/SLOF" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: slof-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "SLOF" When compiling the libnet code with Clang (e.g. for the s390-ccw bios), it complains with the following warning: ipv6.c:447:18: warning: variable length array folded to constant array as an extension [-Wgnu-folding-constant] unsigned short raw[ip6size]; ^ The warning is completely harmless, of course. Anyway let's rewrite the code a little bit to make the compiler silent again. Signed-off-by: Thomas Huth --- lib/libnet/ipv6.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/libnet/ipv6.c b/lib/libnet/ipv6.c index 6420004..259087b 100644 --- a/lib/libnet/ipv6.c +++ b/lib/libnet/ipv6.c @@ -441,10 +441,9 @@ static unsigned short ip6_checksum(struct ip6hdr *ip6h, unsigned char *packet, { int i; unsigned long checksum; - const int ip6size = sizeof(struct ip6hdr)/sizeof(unsigned short); union { struct ip6hdr ip6h; - unsigned short raw[ip6size]; + uint16_t raw[sizeof(struct ip6hdr) / sizeof(uint16_t)]; } pseudo; memcpy (&pseudo.ip6h, ip6h, sizeof(struct ip6hdr)); @@ -455,7 +454,7 @@ static unsigned short ip6_checksum(struct ip6hdr *ip6h, unsigned char *packet, for (checksum = 0, i = 0; i < bytes; i += 2) checksum += (packet[i] << 8) | packet[i + 1]; - for (i = 0; i < ip6size; i++) + for (i = 0; i < (int)(sizeof(pseudo.raw) / sizeof(pseudo.raw[0])); i++) checksum += pseudo.raw[i]; checksum = (checksum >> 16) + (checksum & 0xffff);