From patchwork Thu Sep 19 13:24:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 13807747 Received: from mail-ed1-f54.google.com (mail-ed1-f54.google.com [209.85.208.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BD72819DF76 for ; Thu, 19 Sep 2024 13:25:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.54 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726752303; cv=none; b=eYgwYxqskc4pvSPz2awfWM1efqubM+acvw49nLXJVmu2pOogoo4CGuc30srqwVzCAfGmdC9VIwCP7BWi8H+rWWSyduGGKCAiCsufNh529En/sZH6wZweT2qMv16aXhXDEo7FEYLWr4RGVfL0Cm3FudZ8zjIBrOMMXG10Nn2xBLE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726752303; c=relaxed/simple; bh=obEzbUOat49mFiVOMQjV10vHS3lZgl54eTMgB/iiSJ0=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=s4fNxvl6wOXuhUm3+LJUfhvGfNoFmyvaB86YytiIRyqRs0PooGLu+NPSPCpARFIf/QEVY/mgDTskGUcdZ+pLn1+w602gYXSVuEqmvqIYQ+t6B8940IdN6UmdQNdH2Ts9SBngmAqZwVTZ5k81AwpnFPPL15YfqKEz1Rk1Dm998i0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=amarulasolutions.com; spf=pass smtp.mailfrom=amarulasolutions.com; dkim=pass (1024-bit key) header.d=amarulasolutions.com header.i=@amarulasolutions.com header.b=mGHQQm/8; arc=none smtp.client-ip=209.85.208.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=amarulasolutions.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=amarulasolutions.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amarulasolutions.com header.i=@amarulasolutions.com header.b="mGHQQm/8" Received: by mail-ed1-f54.google.com with SMTP id 4fb4d7f45d1cf-5c26815e174so1239823a12.0 for ; Thu, 19 Sep 2024 06:25:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; t=1726752300; x=1727357100; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=YPYlfu2VkH5W38C/INzwLlNXJPhMZKljvgdLTCWrM5w=; b=mGHQQm/8RtQDirylGdSOchDgQwUZ4OYTAlRULNyRnh599kNQkVvDhrEBS4BQrxMtlw WLoiXobmKQf0eZsy8rFFOPBAbCvWU7jveE/k4mTIBLmBZvtZqJu+puzFikf4QyKfra/K EuPa64LJrKwNn3QUivPaczHBJRw7/VGSQVHVQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726752300; x=1727357100; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=YPYlfu2VkH5W38C/INzwLlNXJPhMZKljvgdLTCWrM5w=; b=BSv9+N3OHhm3HShrmUQo9xBcoaVQlA1QPD8IdpZp3x9p+blwwYFa1sIyv63Bf0nPVL yXG4xS7FbRvJtiYJdq5C0tq4jeLxrUhslvZ5UFird547t5UgduvmuwT5JAaL+GGwJxeV bsqF/Rse+iAcycXVGjowKKMYnDkAZjP1JH3gAUykFqBYB9ShtXTgnWc85VqLXRjP5PqW KaBKgXrTvR8NWP02xepyF0FdDGnv1ZsQtyoKa39UFtBio/fg2ltmFJ7ye+61a7iHnR7M H8kUvs6PC6bRCOVEEq8WK/xkJ7QqA/TtKjlmd8bzVuxCnjB59PeiBQRLBVj1AQI3RcDs 6Aig== X-Gm-Message-State: AOJu0YybhrK/+RwgLb/gbKeAYDjiS/gT/Dk4ZdN0j1dlJ+jIXGorehSI Odf0YzEzZ9UJ8kzi+K7ATpNSorjY47M/IiEmKz7Nx/w7gVlYS3+ZQACxPGcGby+adWVqOMkxrp9 MY5mCVw== X-Google-Smtp-Source: AGHT+IFY+4uXfwE2UtfJYEg2ZJaLY1mX+kpN3b2zjd+E0m1tJXbyyQBUSo+8xtwCl/dzfEFLfGnSNg== X-Received: by 2002:a05:6402:3511:b0:5c4:2efe:c9e3 with SMTP id 4fb4d7f45d1cf-5c42efeccffmr14648207a12.17.1726752299806; Thu, 19 Sep 2024 06:24:59 -0700 (PDT) Received: from dario-ThinkPad-T14s-Gen-2i.homenet.telecomitalia.it ([79.20.102.52]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5c42bb89c4esm5971812a12.61.2024.09.19.06.24.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Sep 2024 06:24:58 -0700 (PDT) From: Dario Binacchi To: netdev@vger.kernel.org Cc: Stephen Hemminger , Dario Binacchi Subject: [PATCH 1/2] arpd: use designated initializers for msghdr structure Date: Thu, 19 Sep 2024 15:24:53 +0200 Message-ID: <20240919132454.7394-1-dario.binacchi@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 This patch fixes the following error: arpd.c:442:17: error: initialization of 'int' from 'void *' makes integer from pointer without a cast [-Wint-conversion] 442 | NULL, 0, raised by Buildroot autobuilder [1]. In the case in question, the analysis of socket.h [2] containing the msghdr structure shows that it has been modified with the addition of padding fields, which cause the compilation error. The use of designated initializers allows the issue to be fixed. struct msghdr { void *msg_name; socklen_t msg_namelen; struct iovec *msg_iov; #if __LONG_MAX > 0x7fffffff && __BYTE_ORDER == __BIG_ENDIAN int __pad1; #endif int msg_iovlen; #if __LONG_MAX > 0x7fffffff && __BYTE_ORDER == __LITTLE_ENDIAN int __pad1; #endif void *msg_control; #if __LONG_MAX > 0x7fffffff && __BYTE_ORDER == __BIG_ENDIAN int __pad2; #endif socklen_t msg_controllen; #if __LONG_MAX > 0x7fffffff && __BYTE_ORDER == __LITTLE_ENDIAN int __pad2; #endif int msg_flags; }; [1] http://autobuild.buildroot.org/results/e4cdfa38ae9578992f1c0ff5c4edae3cc0836e3c/ [2] iproute2/host/mips64-buildroot-linux-musl/sysroot/usr/include/sys/socket.h Signed-off-by: Dario Binacchi --- misc/arpd.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/misc/arpd.c b/misc/arpd.c index e77ef53928a2..b4935c23eebb 100644 --- a/misc/arpd.c +++ b/misc/arpd.c @@ -437,10 +437,10 @@ static void get_kern_msg(void) struct iovec iov; char buf[8192]; struct msghdr msg = { - (void *)&nladdr, sizeof(nladdr), - &iov, 1, - NULL, 0, - 0 + .msg_name = &nladdr, .msg_namelen = sizeof(nladdr), + .msg_iov = &iov, .msg_iovlen = 1, + .msg_control = (void *)NULL, .msg_controllen = 0, + .msg_flags = 0 }; iov.iov_base = buf; From patchwork Thu Sep 19 13:24:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 13807748 Received: from mail-ed1-f43.google.com (mail-ed1-f43.google.com [209.85.208.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 73AE418893D for ; Thu, 19 Sep 2024 13:25:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.43 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726752305; cv=none; b=R8dFHLxIUhlVPJ82r+laoqpB+V2DQCu1tSoe2Sfqq0rOV3FRCwW4g5NPbCdQAvov63D7VR1NYG4bHmaOhXqD9Sy3MI2Uq/JtaBx5ffQWIAP6Z/lPmGrS1Z3Ym7QdlOdKGt2vsL6NGjXRS4VYFGSy5L/p3eT//MtIIelP3NzF7cM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726752305; c=relaxed/simple; bh=PHPevfpJk+NzNSKAui3Hgt7JUYg7sSL+k7we0NX6b2I=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Mle+bSu08baJ93MAc7OzuoB+j3036WxJXrIU/fkmZiK/GtJa8i0o8y94fGzRckOu3wfq2SSrrlfKXCASXDBq8keZ2RSzqEBLUK4bhkdCATu2mMJDQ2/SqG0gllw8m/xI56LObbxW4uqeXzg2cuADW2F2Le/2fOysEdRviMuBuL4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=amarulasolutions.com; spf=pass smtp.mailfrom=amarulasolutions.com; dkim=pass (1024-bit key) header.d=amarulasolutions.com header.i=@amarulasolutions.com header.b=OFjqm9A2; arc=none smtp.client-ip=209.85.208.43 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=amarulasolutions.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=amarulasolutions.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amarulasolutions.com header.i=@amarulasolutions.com header.b="OFjqm9A2" Received: by mail-ed1-f43.google.com with SMTP id 4fb4d7f45d1cf-5c4146c7d5dso1198899a12.3 for ; Thu, 19 Sep 2024 06:25:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; t=1726752301; x=1727357101; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=jXKyj9QfU6TS4dahNlEkSbG4SpYUyfzDDNO0f4/oKhE=; b=OFjqm9A2nBwK07IwSzUnUf9CGeY32GEAPh+A4jHiNR+MA+8MKZ4BH2sdWl+r5j4SUY yrbZ32mQBPVT6Jy0P0EhMACT9Wowyyog5KNCekv/tPeHHFFqK4jhU03It0DKlgCbtakd 1Rd1r/r3vZAQfuQEERhUDR+810BYhFRb/ygOY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726752301; x=1727357101; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=jXKyj9QfU6TS4dahNlEkSbG4SpYUyfzDDNO0f4/oKhE=; b=pBOEed6kMFxpYic5/GS2Q779emAN6181pkSLKSxGusbnppf+or/CvCXJjIK0pdChbk isSKBFwwlRkPDh6SPW6uA0kJeRIWJvos013kg6mc4YXoyCV/iXzPqkabMn62nItTWMAM QpxOyAnIx14B3QEqSJ/0cfOb5w50SVuRoj6t2DbGzN8aJZE4+Nel1sE/QeV6mwrFlF0w piwGLslSGzgSUFR1+GIw9O8xv3vonPE4jw1BHCfQ+vTpyp9dMBmwZzX6HDJTyGVJvrjh yfOu1DsYMQaTQElz9iRhtYd6EEVRQEQAS5IlznY8usLg91zJuEx9sP8n3z7mexeAdOgU VzJw== X-Gm-Message-State: AOJu0YzGnEGgZ4BEa2CbAtt2QxZHetAB6PonoibBrY2OStIdhd445XJ0 4T0s4DzXCjOo+LxLasK30S1tghBUc9nbqUgAL6F85lOcw4+64jtLupnUjigysXytndp7xaHTTrX hv63oHw== X-Google-Smtp-Source: AGHT+IGw6MEqtPQG/0Y84X4e/vyi8aWsDVGP0TBOK26zSIp+11f6AsGoaS/RRyo6b1lvU8/RPLFnXQ== X-Received: by 2002:a05:6402:2549:b0:5c2:6090:4047 with SMTP id 4fb4d7f45d1cf-5c41e093ecamr20754133a12.8.1726752301492; Thu, 19 Sep 2024 06:25:01 -0700 (PDT) Received: from dario-ThinkPad-T14s-Gen-2i.homenet.telecomitalia.it ([79.20.102.52]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5c42bb89c4esm5971812a12.61.2024.09.19.06.25.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Sep 2024 06:25:00 -0700 (PDT) From: Dario Binacchi To: netdev@vger.kernel.org Cc: Stephen Hemminger , Dario Binacchi Subject: [PATCH 2/2] arpd: drop useless initializers Date: Thu, 19 Sep 2024 15:24:54 +0200 Message-ID: <20240919132454.7394-2-dario.binacchi@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240919132454.7394-1-dario.binacchi@amarulasolutions.com> References: <20240919132454.7394-1-dario.binacchi@amarulasolutions.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 It is useless to initialize the fields of a structure to their default values. This patch keeps the initialization only for those fields that are not set to their default values. Signed-off-by: Dario Binacchi --- misc/arpd.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/misc/arpd.c b/misc/arpd.c index b4935c23eebb..a2ae76a41f8d 100644 --- a/misc/arpd.c +++ b/misc/arpd.c @@ -439,8 +439,6 @@ static void get_kern_msg(void) struct msghdr msg = { .msg_name = &nladdr, .msg_namelen = sizeof(nladdr), .msg_iov = &iov, .msg_iovlen = 1, - .msg_control = (void *)NULL, .msg_controllen = 0, - .msg_flags = 0 }; iov.iov_base = buf;