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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7EC2FC54EAA for ; Fri, 27 Jan 2023 13:54:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233158AbjA0NyP (ORCPT ); Fri, 27 Jan 2023 08:54:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34022 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229847AbjA0NyP (ORCPT ); Fri, 27 Jan 2023 08:54:15 -0500 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F3B12C155 for ; Fri, 27 Jan 2023 05:54:12 -0800 (PST) Received: from pps.filterd (m0127361.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 30RC1OrS010035; Fri, 27 Jan 2023 13:10:31 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : in-reply-to : references : date : message-id : content-type : mime-version; s=pp1; bh=mI8i9MTSsYzZV7suqERmHFNF665YMmu1efTHtlRfWHE=; b=aivNL1MD05Rtv47yVCNmilQz/2wYvQjoXMeP3eEAW25CX/hQPDz4COct1JQYs3NM0Uqs 8NTOJsdsUVuBBOGFE2uc2CM6icgaJRXZO8Aa/ncIRZCuLmyUJFjExbtQIDQ+0/3Luyyw ygM/TUIwTjA3U/natamqiTkAUXfk8MjWH2JAD9SqG7w/NQd2iZKzocDoyLy+tB+5YoAg wXpPix9ORiSCcTttdFqt8wMNVBPzosl5HeAqIXeFfd6N6R6P5xu447BHoZkJSSvZpSAL 7WwWEAXWNGor41HMwEiHyu+qfISgCBvYE6QOhJ7bpS23g1rg45xfElV0XCb5JzTyQFhr ZQ== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3nce8m9pcn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 27 Jan 2023 13:10:31 +0000 Received: from m0127361.ppops.net (m0127361.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 30RC3Tje020110; Fri, 27 Jan 2023 13:10:30 GMT Received: from ppma01dal.us.ibm.com (83.d6.3fa9.ip4.static.sl-reverse.com [169.63.214.131]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3nce8m9pcb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 27 Jan 2023 13:10:30 +0000 Received: from pps.filterd (ppma01dal.us.ibm.com [127.0.0.1]) by ppma01dal.us.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 30RAoXBj004500; Fri, 27 Jan 2023 13:10:30 GMT Received: from smtprelay02.wdc07v.mail.ibm.com ([9.208.129.120]) by ppma01dal.us.ibm.com (PPS) with ESMTPS id 3n87p8k4dk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 27 Jan 2023 13:10:30 +0000 Received: from smtpav03.wdc07v.mail.ibm.com (smtpav03.wdc07v.mail.ibm.com [10.39.53.230]) by smtprelay02.wdc07v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 30RDASUs3605134 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 27 Jan 2023 13:10:28 GMT Received: from smtpav03.wdc07v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 94EAD5805C; Fri, 27 Jan 2023 13:10:28 +0000 (GMT) Received: from smtpav03.wdc07v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 714FC58054; Fri, 27 Jan 2023 13:10:28 +0000 (GMT) Received: from localhost (unknown [9.211.111.131]) by smtpav03.wdc07v.mail.ibm.com (Postfix) with ESMTP; Fri, 27 Jan 2023 13:10:28 +0000 (GMT) From: Nathan Lynch To: Andrew Donnellan , linuxppc-dev@lists.ozlabs.org Cc: Leonardo Bras , linux-hardening@vger.kernel.org Subject: Re: [PATCH] powerpc/rtas: Replace one-element arrays with flexible arrays In-Reply-To: <20230127085023.271674-1-ajd@linux.ibm.com> References: <20230127085023.271674-1-ajd@linux.ibm.com> Date: Fri, 27 Jan 2023 07:10:28 -0600 Message-ID: <87357wp1h7.fsf@linux.ibm.com> Content-Type: text/plain X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: KIbM4aQG0R9_EksZ-y0t-UPOiI6ZCa8Y X-Proofpoint-GUID: T1IUKyhZvGmcsYwWc3AR1jPPeD8FaAus X-Proofpoint-UnRewURL: 0 URL was un-rewritten MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.930,Hydra:6.0.562,FMLib:17.11.122.1 definitions=2023-01-27_08,2023-01-27_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1011 bulkscore=0 mlxscore=0 spamscore=0 impostorscore=0 malwarescore=0 suspectscore=0 mlxlogscore=999 priorityscore=1501 adultscore=0 phishscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2301270123 Precedence: bulk List-ID: X-Mailing-List: linux-hardening@vger.kernel.org Andrew Donnellan writes: > Using a one-element array as a fake flexible array is deprecated. > > Replace the one-element flexible arrays in rtas-types.h with C99 standard > flexible array members instead. > > This helps us move towards enabling -fstrict-flex-arrays=3 in future. > > Found using scripts/coccinelle/misc/flexible_array.cocci. > > Cc: Nathan Lynch > Cc: Leonardo Bras > Cc: linux-hardening@vger.kernel.org > Link: https://github.com/KSPP/linux/issues/21 > Link: https://github.com/KSPP/linux/issues/79 > Signed-off-by: Andrew Donnellan > --- > arch/powerpc/include/asm/rtas-types.h | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/arch/powerpc/include/asm/rtas-types.h b/arch/powerpc/include/asm/rtas-types.h > index 8df6235d64d1..40ec03a05c0b 100644 > --- a/arch/powerpc/include/asm/rtas-types.h > +++ b/arch/powerpc/include/asm/rtas-types.h > @@ -44,7 +44,7 @@ struct rtas_error_log { > */ > u8 byte3; /* General event or error*/ > __be32 extended_log_length; /* length in bytes */ > - unsigned char buffer[1]; /* Start of extended log */ > + unsigned char buffer[]; /* Start of extended log */ > /* Variable length. */ > }; > > @@ -85,7 +85,7 @@ struct rtas_ext_event_log_v6 { > /* that defines the format for */ > /* the vendor specific log type */ > /* Byte 16-end of log */ > - u8 vendor_log[1]; /* Start of vendor specific log */ > + u8 vendor_log[]; /* Start of vendor specific log */ > /* Variable length. */ > }; I see at least one place that consults the size of one of these structs, in get_pseries_errorlog(): /* Check that we understand the format */ if (ext_log_length < sizeof(struct rtas_ext_event_log_v6) || ... Don't all such sites need to be audited/adjusted for changes like this?