Received: by 2002:ab2:6816:0:b0:1f9:5764:f03e with SMTP id t22csp2395508lqo; Mon, 20 May 2024 04:49:11 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVFqMoBL5XPa0m0yNsy6K15OZyndM4MgpSZDmlLtTdAGx0yaJrvTrJ3WWBz089v8/AhFsiRsclWfq0LvzETKuXhVQRmpEPGLtEeeYcH5A== X-Google-Smtp-Source: AGHT+IGCSXj6Irz4VqE8QAFnmI/mEZDK1j/74hg+3XWYR7snEPo4jLHwnj+e9wfHiMrzF3JyoxwC X-Received: by 2002:a17:906:a050:b0:a59:cdf4:f948 with SMTP id a640c23a62f3a-a5a2d675dc5mr2632057566b.65.1716205751800; Mon, 20 May 2024 04:49:11 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716205751; cv=pass; d=google.com; s=arc-20160816; b=vwum1HE+GiJCUuvLKS8QQjFBdy7ukv2JHOP/jqk0HV0Y+DlZYkFvW26gH9q1W9MLPJ lXXw4yjG0sbxyaN8IVghTra0nOySGXq9IGVyZKYnSXO/fZ6ZN8zXyow/N/xXeh0MY0Hi NEnr3DbMyhBYsJmWpz+763jXxRQIiNwWWQn8OT1JEmQIVtXavzLgORvR1U2/R2QN1wv4 zyCMIwSiwC/FyOc7kT3Yl6x3W9yUyISyiTLfCqKsl8AHN5l9Knl7oJn+l50BeZA9hRwH tJImLgj327Ysgk4IHV7ci6dUDol3jPUs0BQsqE8LGQaLC8VkFEhXusbQ9rg/TErVVKI7 ihSA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :user-agent:content-transfer-encoding:references:in-reply-to:date:cc :to:from:subject:message-id:dkim-signature; bh=KpJ6k4J59qKz0uHRTXxneTJbQDK8g074xXtvyyznLwk=; fh=k09FYiWjKCyYisN3RB2Me6ipNMlsa9nTd9lWMCS82Fc=; b=wFYsmgXD8oiJ5l/mP6OQ4BzM9u3XCCzfEK6RY65V6+j8Ih50YcoTc4VOCMg/M0a6uG SBXgtC93HM0aXrv3SqRAysJnsxzoqHUUkQZkVRdg/P3tEfDXz58Djl25dbFqrwUOPL3C 81uxkwcUMd+NqG1sq9xr6VUOGnGWsIgAneDrSQBDk6CQ8S/Xe5oxjQ9G3Ap/7hwhO8AS eqOy/ibFd062ynty54DbSGwY7YEk669HArt5UiEr4uPEnzcypYzqDkFo44+waRS1OMwI Yl83PVoR3hYinz0A9qgGP+Y7V+Hl+72LAFRQbg6dZKKTFoL7ItP7pcMt8ccFBrbXJbgg QvRg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@sipsolutions.net header.s=mail header.b=uhjp+uMG; arc=pass (i=1 spf=pass spfdomain=sipsolutions.net dkim=pass dkdomain=sipsolutions.net dmarc=pass fromdomain=sipsolutions.net); spf=pass (google.com: domain of linux-wireless+bounces-7841-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-wireless+bounces-7841-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=REJECT dis=NONE) header.from=sipsolutions.net Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id a640c23a62f3a-a5cdabd9b89si578161466b.885.2024.05.20.04.49.11 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 May 2024 04:49:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless+bounces-7841-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@sipsolutions.net header.s=mail header.b=uhjp+uMG; arc=pass (i=1 spf=pass spfdomain=sipsolutions.net dkim=pass dkdomain=sipsolutions.net dmarc=pass fromdomain=sipsolutions.net); spf=pass (google.com: domain of linux-wireless+bounces-7841-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-wireless+bounces-7841-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=REJECT dis=NONE) header.from=sipsolutions.net Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 884581F22972 for ; Mon, 20 May 2024 11:49:11 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9F85C7711E; Mon, 20 May 2024 11:45:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=sipsolutions.net header.i=@sipsolutions.net header.b="uhjp+uMG" X-Original-To: linux-wireless@vger.kernel.org Received: from sipsolutions.net (s3.sipsolutions.net [168.119.38.16]) (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 A326977F2F; Mon, 20 May 2024 11:45:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=168.119.38.16 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716205543; cv=none; b=oQsV6IuF+hX6WJBBAig/pIJTM2ykXdfOOXlCH+ynVubbdewrdtukhHAxzfHywXtCXl/9pdQvAJzruQaLgNYFEvfoEPP023uhhtak7AYGlmC/4+9YpSWb8Vx9rYAIMUlMonLJAu7rHHHcD0aesPESESpCkhIa2MOfgJJ/siQpNOs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716205543; c=relaxed/simple; bh=F3rZG5RorXcLyQ01SqQykrqAbDvDdcRo5CeTiIqlEfs=; h=Message-ID:Subject:From:To:Cc:Date:In-Reply-To:References: Content-Type:MIME-Version; b=FJbWhEAJ4i3LZCCLbcK9ThEcZd15alGFlVk/fO4aFmo3xzNyCqqKMsYkhT2Aqh+KmqyvD5tT4nJOeIOfk9L8CqQgNuU2x/pAhC4qS/tzidJycbm3oMbb6DRSVuOTvXPZ7j9ccqTEZrT+4iVOdwgvJItCaO5EBphx1PF1mjDZfUQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=sipsolutions.net; spf=pass smtp.mailfrom=sipsolutions.net; dkim=pass (2048-bit key) header.d=sipsolutions.net header.i=@sipsolutions.net header.b=uhjp+uMG; arc=none smtp.client-ip=168.119.38.16 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=sipsolutions.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=sipsolutions.net DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sipsolutions.net; s=mail; h=MIME-Version:Content-Transfer-Encoding: Content-Type:References:In-Reply-To:Date:Cc:To:From:Subject:Message-ID:Sender :Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-To: Resent-Cc:Resent-Message-ID; bh=KpJ6k4J59qKz0uHRTXxneTJbQDK8g074xXtvyyznLwk=; t=1716205541; x=1717415141; b=uhjp+uMGuc+bFOkFese4kzhquCy2tQ6KSUgx1Hs9K1vLmKy RrzhRbmjY4SgUZC+mQBDqadkkvTYikbZ9CpEHjl2CHP3E4qQtWziQDYBssl7NuiAyhcQAmzY3Bbk6 yybQhEV60jmsYse3O2VJhgL7QraYBT8WORoja9HNwS/V36fVDxtmRddob8OUS/TTNQgI1TjwE8+aA 6yNlPdIODmaLPF0sB5SaiDSLI4jTJwIX/xz4QuLjEXR8G+mIhde8ouKyxRX22zjGzq8+rxLgeeK7v 9GjL3iQ2Of2Km8YuV93gN9lGBAAK962Ycw0bAGOCGqLDQMxOKbXTZgHtqFp41NuA==; Received: by sipsolutions.net with esmtpsa (TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.97) (envelope-from ) id 1s91SU-00000000C2y-1k4V; Mon, 20 May 2024 13:45:38 +0200 Message-ID: <95f3e147de837b4833e6cf6eb67108f96640af4e.camel@sipsolutions.net> Subject: Re: [WARNING] memcpy: detected field-spanning write (size 1005) of single field "&out_cmd->cmd.payload" at drivers/net/wireless/intel/iwlegacy/common.c:3173 (size 320) From: Johannes Berg To: Stanislaw Gruszka , Kees Cook Cc: "Gustavo A. R. Silva" , Xose Vazquez Perez , linux-wireless@vger.kernel.org, linux-hardening@vger.kernel.org Date: Mon, 20 May 2024 13:45:37 +0200 In-Reply-To: <20240520073210.GA693073@wp.pl> References: <2c534d01-449a-43f4-9216-eacdb3b35577@gmail.com> <20240518092939.GA643846@wp.pl> <202405181033.6399B7E416@keescook> <20240520073210.GA693073@wp.pl> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.50.4 (3.50.4-1.fc39) Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-malware-bazaar: not-scanned > +++ b/drivers/net/wireless/intel/iwlegacy/commands.h > @@ -201,9 +201,6 @@ struct il_cmd_header { > * 15 unsolicited RX or uCode-originated notification > */ > __le16 sequence; > - > - /* command or response/notification data follows immediately */ > - u8 data[]; > } __packed; [...] > - memcpy(&out_cmd->cmd.payload, cmd->data, cmd->len); > + memcpy(&out_cmd->cmd.raw, cmd->data, cmd->len); [...] > +++ b/drivers/net/wireless/intel/iwlegacy/common.h > @@ -555,6 +555,7 @@ struct il_device_cmd { > u32 val32; > struct il_tx_cmd tx; > u8 payload[DEF_CMD_PAYLOAD_SIZE]; > + DECLARE_FLEX_ARRAY(u8, raw); >=20 I don't think this is right, now the raw comes after DEF_CMD_PAYLOAD_SIZE? You want it to be a union with payload, I'd think. johannes