From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-ed1-f51.google.com (mail-ed1-f51.google.com [209.85.208.51]) (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 040542868AB for ; Fri, 14 Aug 2026 13:33:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.51 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786714435; cv=none; b=HBHudv8Y+ZTYFW48ujTEn40zo1O5wrX+DGkXqdmyUM9yJ01rqIUWq1sPl47+/nj/m/hSAwh/tpqx9m4LCthlYPIBnTpQQfyOZ/mQzY+dA7LgFhrr8DjCsh5VkEEqzPorwvhKlKzJOOxkkVDxS7OlR7xkSnovIaN9lkEj6ag994w= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786714435; c=relaxed/simple; bh=xkgFJCp/Zk/sqzv4xyN/NJ242EfBE169OBRzxFIrK7g=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=WVfgtuzsgknlMYZNGFqUm1loH3nn2fx+2ctSQEq3dWZfPapq1DmPbmaLerVqEfmkcrM5EkVDLgtCvlG2Tpuyd7vOeYITjJ042Zlgw0gkKF2WHhAHMQGAoEYva8BES/qyuKWgrwsg+f9nu8AW3IWMkWErdbAwzTgzPS5DQlB6pPg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=linux-m68k.org; spf=pass smtp.mailfrom=gmail.com; arc=none smtp.client-ip=209.85.208.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=linux-m68k.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ed1-f51.google.com with SMTP id 4fb4d7f45d1cf-6a38098734bso1498805a12.1 for ; Fri, 14 Aug 2026 06:33:53 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1786714432; x=1787319232; h=content-type:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to:content-type; bh=NBTxHEUUi4J2ttd+XtUaUBMmZySWV/hj2+fFGqKDlJM=; b=cvvefitV74IPUiprN1DPX/A3HkVa66aYsoHtMTVp2eDs2riuG1m4SBCpcBmzcBtCbc UoPghuJacyovrfwK8bAOiUsSdnKyivgaeqqiO9vRwJdgs13p6wr5QmIIB3CO4wbBHT1l x2UrK+oqd8GQ2SsTGxPO7y+3BGzFLS6sIoi/wv5zjVxYUPN62lDqs2VfRDJOqQwQEdoH r42hkKI9lB1xVwt1kqCmgPY7p0ZCYcy7BUJu8xCfp4tByZfRYNl13YZQRsP2TFx4AKvZ iuQI7HxcGxD1P4Q8orPvse8VNOSgZK5cRA2489GVRgzHceGpEwUGFDGltX99Z2SiLLoZ HsMw== X-Forwarded-Encrypted: i=1; AHgh+RqHn6thj0YZYl68XDuV0+Ogel3mKILILJQaET2FyQiTolajVhyQNaUgE2iqZG/9IFEhyDN/j5ETJ9Nr4fM=@vger.kernel.org X-Gm-Message-State: AOJu0Yz4nDrhZ9BKWVXSJGnRGz2xKLKeBl4JxYOMzz3oncJ23uZJeo5n 4Y4Xc0Pe5dV0eB81wZJOoPebGXYbF1BMYngIKRHHh4VlIRZ82L7YaqopIoS3hN6SAaE= X-Gm-Gg: AR+sD124dcHn3LYLaPnxtS3myN6hCV6chef8DOUkZiPY9H3f/kRwrdsV5OdLPXwfFT3 LAfCVB3m/YKoQEXkDfcsInUOz3FB06ouWLSTbz2+ODwqtYQUkFSAAGLgtUXH4j82ZddBzIzEHS/ 62IknHUCvuujeQUIHxQBi1CUsgQxYEIPU7ZhcXfCZOENEWXlcDlTdpw3U23weiZ0wdjQafBkLJy 7HX5TysjjBKYPGuDCNa355mrr/m5ljxGxHhBUq/R5ExMxJsJGC+X8UtTA7vch7/aoDEUVNRi6yl W46kPkpnPCjU4I30LMCROe3Rp7TfL41TsmoqdlHrQ27F1z9MLbeAhRey9i7mAWfGrWcjRmkEeT3 L0VmTdYdjr/Kne3OBEmURdo52Bni6d4NwxI2byhhNUYieB1igI8F7QLDa0IRj28JNitkYy54UiA UjjojYCln06UnrnsQzewTZV8d2pXEAaQSIlbkZLYnDtNXgSU1D5cVHd/2GPTWzxYq5dg2etMDar Pc2vk1CXbPAhU6g0n2t8rcTTw== X-Received: by 2002:a17:906:ee8a:b0:c1c:5c90:1bb0 with SMTP id a640c23a62f3a-c212a1fbc7bmr253846666b.8.1786714432102; Fri, 14 Aug 2026 06:33:52 -0700 (PDT) Received: from mail-ed1-f42.google.com (mail-ed1-f42.google.com. [209.85.208.42]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-c2123821bfasm104293766b.51.2026.08.14.06.33.50 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 14 Aug 2026 06:33:51 -0700 (PDT) Received: by mail-ed1-f42.google.com with SMTP id 4fb4d7f45d1cf-6a0c8283146so1452874a12.0 for ; Fri, 14 Aug 2026 06:33:50 -0700 (PDT) X-Forwarded-Encrypted: i=1; AHgh+RrY0eynSUzKOzNb+AD1flDNeAtb0hi801OdkjWd7Fv9ZAtkBOzkF2fENhLyrQMRrrfBjvcV9yJ9G2L8CuY=@vger.kernel.org X-Received: by 2002:a05:6402:1cd0:b0:6a0:a644:355e with SMTP id 4fb4d7f45d1cf-6a38a8bedf4mr2981067a12.2.1786714430006; Fri, 14 Aug 2026 06:33:50 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20260813-rzn1-miic-fix-array-v1-1-b58cafcc917e@reliablecontrols.com> In-Reply-To: From: Geert Uytterhoeven Date: Fri, 14 Aug 2026 15:33:37 +0200 X-Gmail-Original-Message-ID: X-Gm-Features: AUfX_mz_hQ0TBj7ICikSgGrzarOlKuc0im7GCeWn2gWIWPpQ5K6KidfPNAk4oAg Message-ID: Subject: Re: [PATCH] net: pcs: rzn1-miic: Fix config array initialization To: Andrew Lunn Cc: khendry@reliablecontrols.com, =?UTF-8?B?Q2zDqW1lbnQgTMOpZ2Vy?= , Heiner Kallweit , Russell King , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , linux-renesas-soc@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Lad Prabhakar Content-Type: text/plain; charset="UTF-8" Hi Andrew, On Fri, 14 Aug 2026 at 15:14, Andrew Lunn wrote: > On Fri, Aug 14, 2026 at 10:11:28AM +0200, Geert Uytterhoeven wrote: > > On Thu, 13 Aug 2026 at 20:09, Kyle Hendry via B4 Relay > > wrote: > > > From: Kyle Hendry > > > > > > Fix memset parameters to initialize the entire DT value array > > > > > > Signed-off-by: Kyle Hendry > > > > Fixes: f39e968dc168a7bd ("net: pcs: rzn1-miic: Move configuration data > > to SoC-specific struct") > > Reviewed-by: Geert Uytterhoeven > > > > > --- a/drivers/net/pcs/pcs-rzn1-miic.c > > > +++ b/drivers/net/pcs/pcs-rzn1-miic.c > > > @@ -683,7 +683,7 @@ static int miic_parse_dt(struct miic *miic, u32 *mode_cfg) > > > if (!dt_val) > > > return -ENOMEM; > > > > > > - memset(dt_val, MIIC_MODCTRL_CONF_NONE, sizeof(*dt_val)); > > > + memset(dt_val, MIIC_MODCTRL_CONF_NONE, miic->of_data->conf_conv_count); > > Sorry for hijacking your reply, i already deleted the original email. Np ;-) > This is correct, but could maybe be better. dt_val is allocated with. > > kmalloc_objs(*dt_val, miic->of_data->conf_conv_count) > > This allocates objects. It just happens your objects are s8, so size > of 1. But the memset() would be "more correct" with: > > memset(dt_val, MIIC_MODCTRL_CONF_NONE, sizeof(*dt_val) * miic->of_data->conf_conv_count); That would indeed be more correct. Note that there is an opportunity for a buffer overflow below: for_each_available_child_of_node(np, conv) { if (of_property_read_u32(conv, "reg", &port)) continue; [...] /* Adjust for 0 based index */ dt_val[port + !miic->of_data->miic_port_start] = conf; [...] What if "port" is out-of-range? Do we just rely on dtbs_check to catch this? } > And i checked, there is no memset_objs(). The *_objs() APIs are still rather new and limited. Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds