Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3003962pxj; Mon, 17 May 2021 15:21:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyJxexJfmKniNcWiG5YN7NWNpROiokAqBucorBEkyi1ygK/jHDdU9GlF92y02LGk/xmirgy X-Received: by 2002:a50:ccc9:: with SMTP id b9mr2755303edj.316.1621290076587; Mon, 17 May 2021 15:21:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621290076; cv=none; d=google.com; s=arc-20160816; b=g6GjFeqhbFSAoi3WhucTXh1vwxPTO1mg9osJ8q14WXnlOycbA1Huo7vl2x4RCRj2yC to7IaFgMZ7mUjMpwLhZYTSpeUKniP1R7DJ+pLinGkHiA2MDruyMOqqGylwTzlXd/roHI 6pebA29Y6aC9GAUTzWC0GQA4vmcnKaT+xUCAYZoANkMgbQ+UZwgv0QzmqYPdC05FQpaA jKLop5NV0TpWcNIfqho7hU4cYnYydrBqHOHkRjdm1IOuyjj50Mwv8D0UDxLES+6deGWo vhUPIdTEPQ0XUrOAe6t1bN3eI1DcZyd9hDM/vEffO8v1qVe8tetnvOSwWjL3/zbu8lOA WPIQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=QkgZDWlDKD4XG8Sv8CNRmJcadZP+BVe6H6pi/vNZ/F4=; b=k+2bq1W0Du6ZgSsG7lRCaUTdwdKPrklHCY/Gu8FEuLbdnth2+BwzMvJsKdlOkcOcp2 ZRdGbCcCtHyawiG6NODT4LEXXnVyFHIXHNwzi6ASwxiRjaguNlywMVRs2aCr9Bq9yksl BuqVeJ0f2b8xAFuRs/voCjBa8SMdDkWt5jUEh2amBeBzdbFk7OQ6sS+3/FT2KNoEH/sU 9cE6kX6TQpTPRULCp2NTrA+euA2rmuX44WJGqIfIpmEVOhNicxaex48VcN7sn4RsbtdW cPdTRqcPrJ5xfnTRIhkcwuFQTIP+mFDQVnu9glO/PpY6bYPopHX+yZONKk4nqUEX9oKN bfCg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=XeiVqZA5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h7si14660059edt.10.2021.05.17.15.20.53; Mon, 17 May 2021 15:21:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=XeiVqZA5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238548AbhEQONM (ORCPT + 99 others); Mon, 17 May 2021 10:13:12 -0400 Received: from mail.kernel.org ([198.145.29.99]:58350 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238593AbhEQOLU (ORCPT ); Mon, 17 May 2021 10:11:20 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 57825613C7; Mon, 17 May 2021 14:07:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621260460; bh=fRKurCIjE3qmFmAHeK/5u0LBLUSpKJz0gOlppAgbgXQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XeiVqZA5DaHTuj/amsQUC3ejH7C+n9HeMkiNSchAMOZ8vW/e3qUw4Rf2eyurkHMPA MvWMaS1TxlROrXgfQd03JV+dSWqPf+Ild2ubg8KLGzcokgyxk3ChxPkKiDIxf5jDxb gHrVjni0o51cnStHY9spar+KVNZY8onlx/EvYVLo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, kernel test robot , "Gustavo A. R. Silva" , Kees Cook , Marcelo Ricardo Leitner , "David S. Miller" , Sasha Levin Subject: [PATCH 5.12 091/363] sctp: Fix out-of-bounds warning in sctp_process_asconf_param() Date: Mon, 17 May 2021 15:59:17 +0200 Message-Id: <20210517140305.672507213@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210517140302.508966430@linuxfoundation.org> References: <20210517140302.508966430@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Gustavo A. R. Silva [ Upstream commit e5272ad4aab347dde5610c0aedb786219e3ff793 ] Fix the following out-of-bounds warning: net/sctp/sm_make_chunk.c:3150:4: warning: 'memcpy' offset [17, 28] from the object at 'addr' is out of the bounds of referenced subobject 'v4' with type 'struct sockaddr_in' at offset 0 [-Warray-bounds] This helps with the ongoing efforts to globally enable -Warray-bounds and get us closer to being able to tighten the FORTIFY_SOURCE routines on memcpy(). Link: https://github.com/KSPP/linux/issues/109 Reported-by: kernel test robot Signed-off-by: Gustavo A. R. Silva Reviewed-by: Kees Cook Acked-by: Marcelo Ricardo Leitner Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- net/sctp/sm_make_chunk.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/sctp/sm_make_chunk.c b/net/sctp/sm_make_chunk.c index f77484df097b..da4ce0947c3a 100644 --- a/net/sctp/sm_make_chunk.c +++ b/net/sctp/sm_make_chunk.c @@ -3147,7 +3147,7 @@ static __be16 sctp_process_asconf_param(struct sctp_association *asoc, * primary. */ if (af->is_any(&addr)) - memcpy(&addr.v4, sctp_source(asconf), sizeof(addr)); + memcpy(&addr, sctp_source(asconf), sizeof(addr)); if (security_sctp_bind_connect(asoc->ep->base.sk, SCTP_PARAM_SET_PRIMARY, -- 2.30.2