From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-172.mta1.migadu.com (out-172.mta1.migadu.com [95.215.58.172]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 08AAD40BF5 for ; Sat, 19 Apr 2025 10:35:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1745058957; cv=none; b=nEtXst0lYnTJjXGzxnasMgoboOXRuKbZ7uz9hkVlVLiGeIcXYRCFseKeo/KOB3WHr5zqnhN6o+o72B1j1lsjyrOYXcrKNWuLKesENFTq6CF3Ice5s0wOKt1YxVYIZVE+ePFsiiI0cXt42btDtkVkh13KrnrnCCwSkSDtCo44UfU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1745058957; c=relaxed/simple; bh=bVCR+fA30tF4GjVlZMJHRBKnbcj87eua+ehlMiAJLg0=; h=Content-Type:Mime-Version:Subject:From:In-Reply-To:Date:Cc: Message-Id:References:To; b=O1E6D1mp+BQxU+cC61vGX0wmoxStGuTJPP+kgzP8erF2DDLcnZoJwe+xV5nmqGCh2RPBozx1hsaSqUfbWNCt1IzqZibHrLkn6IuKufANlrTdqFiqMuZ7roDme9AaJD+pMB2c+kA0YgGudBrv/yulOZUZCKcBxtWlvPmn2Wyr1vI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=DRwGSjmZ; arc=none smtp.client-ip=95.215.58.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="DRwGSjmZ" Content-Type: text/plain; charset=utf-8 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1745058953; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=E0cjA398QKtX5LZgMG38M1nQogQDA0zqD26aOnhTivM=; b=DRwGSjmZk2oQXGeMn8E0tYGgzibZ/Vgc0lCTc7VGLaa8Ilv9RFP6NawIZGiKHGIHWWUqCK efHZmMs3D9aWsPNEr9qsc1ua0ZFDYNFe1HRhdU0yrKcimQpLzn71kxtlxo23WlMJuoQmhg 8cV8dEIEy4U7yvGTexVh/BkgUXz7Q3A= Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3776.700.51.11.2\)) Subject: Re: [PATCH v2] MIPS: Fix MAX_REG_OFFSET and remove zero-length struct member X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Thorsten Blum In-Reply-To: Date: Sat, 19 Apr 2025 12:35:38 +0200 Cc: "Maciej W. Rozycki" , Thomas Bogendoerfer , Oleg Nesterov , linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable Message-Id: <505DF3CB-F7E2-4233-B39E-654FB5BEB811@linux.dev> References: <20250417174712.69292-2-thorsten.blum@linux.dev> <9F6CA7CB-B36A-4F79-B78C-7ED63E39260D@linux.dev> To: Huacai Chen X-Migadu-Flow: FLOW_OUT Hi Huacai, On 19. Apr 2025, at 04:56, Huacai Chen wrote: > On Sat, Apr 19, 2025 at 4:22=E2=80=AFAM Thorsten Blum wrote: >> On 18. Apr 2025, at 22:18, Thorsten Blum wrote: >>> On 18. Apr 2025, at 17:14, Maciej W. Rozycki wrote: >>>> On Fri, 18 Apr 2025, Thorsten Blum wrote: >>>>>>> Does regs_get_register() even work for CPU_CAVIUM_OCTEON when = accessing >>>>>>> the last two registers because they're both ULL, not UL? = (independent of >>>>>>> my patch) >>>>>>=20 >>>>>> Or rather two arrays of registers. With 32-bit configurations = their >>>>>> contents have to be retrieved by pieces. I don't know if it's = handled by >>>>>> the caller(s) though as I'm not familiar with this interface. >>>>>=20 >>>>> Ah, CPU_CAVIUM_OCTEON seems to be 64-bit only, so there's no = difference >>>>> between UL and ULL. Then both my patch and your suggestion: >>>>=20 >>>> So it seems odd to use `long long int' here, but I can't be = bothered to >>>> check history. There could be a valid reason or it could be just = sloppy >>>> coding. >>>>=20 >>>>> I still prefer my approach without '__last[0]' because it also = silences >>>>> the following false-positive Coccinelle warning, which is how I = stumbled >>>>> upon this in the first place: >>>>>=20 >>>>> ./ptrace.h:51:15-21: WARNING use flexible-array member instead >>>>=20 >>>> So make `__last' a flexible array instead? With a separate patch. >>>=20 >>> No, '__last[0]' is a fake flexible array and the Coccinelle warning = is >>> wrong. We should either ignore the warning or silence it by removing = the >>> marker, but turning it into a real flexible array doesn't make = sense. >>> I'd prefer to just remove it from the struct. >>>=20 >>> Stefan or Oleg, do you have any preference? >>=20 >> Sorry, I meant Thomas, not Stefan. > In my opinion just changing __last[0] to __last[] is OK, no other > actions needed. That doesn't fix the value of MAX_REG_OFFSET - you might be missing some of the context here. Thanks, Thorsten