Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp846799imu; Tue, 11 Dec 2018 08:27:08 -0800 (PST) X-Google-Smtp-Source: AFSGD/WnuZsXbQ6/sFsKsJeRLeeLrkJwuw2GwjG0hdmzBZ5mVna9uKRx57uYFoWxpB2348KMd31Y X-Received: by 2002:a17:902:a40f:: with SMTP id p15mr17042707plq.286.1544545628781; Tue, 11 Dec 2018 08:27:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544545628; cv=none; d=google.com; s=arc-20160816; b=BVOhRkPleRS7HwzArfo/jAmvnHkGVgU6y5xwuhMNLstQL6H5XgKtlKvVhyiQkXQnmk 1BsgzI39vkMVV9S3RkLTsyKxGtZKEY1dkdAUuNVkdroIBIlUIkbGrxhrmEsCz4i2oPHv UgL4w7QpV1MZ/qg7WaONEL0M3FCo89qCPd2IklXT7I0tL5ij7AZr4N4zddYn3o8pH378 wRwa3GE8xL9PqT9/cJ1dihN1zVE1KLARaxEj6joQz2wHUftrf79agK59GeEnqKxN0NoV I5f/ag6T18hrFJygkFma3O4AN759WYAYbriY5vTkeL8srMmIk+fZG4/pUgUIOywCv3Ed rWGA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=xnPJDMOuQMgOdaaZKJ/7o/6b1dVhnkGcnpS692xl5g4=; b=YBX48GZ5c87oUvGdL0CMMDX/+H3MqW5aY7+gbAy7TbaBLPKSgsvJzRbDtEtJBr2MCq +3ZRL3/I5S+uAPQ0IhLrCAdK2rHlkcP/i2ogQPPtBH+TU+53Gu6hoqpmDrZGBSwGBs1F En6Xs5EaxvaxV+187uR8cytJLyHuUFEi1Sb3JhfqhebVZNCrjy0NYOyq2xdelZlEA8+L Sjcg/BkXu6hXV0xEAIhnnlD7OOZvS/OCtmZ4HVxrhsKIJhSDxjg0LU7EQYA08cXQxAmr b23/qdMv1YeAwCHVJPDwb81afMgNpouNFVcaGfl9NtGiPpdLfMBMbYJj3tf6w/nRKTYZ jmzw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=doZddG2t; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g7si12783378plt.212.2018.12.11.08.26.48; Tue, 11 Dec 2018 08:27:08 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=doZddG2t; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727444AbeLKQYI (ORCPT + 99 others); Tue, 11 Dec 2018 11:24:08 -0500 Received: from mail.kernel.org ([198.145.29.99]:59414 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727391AbeLKPnA (ORCPT ); Tue, 11 Dec 2018 10:43:00 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id E046620880; Tue, 11 Dec 2018 15:42:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1544542979; bh=XpabAapNKuqLW1l7nCDYXqYiUivrGyGDh/y3Lgp4m3E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=doZddG2tYv5/VZ5c5vCCcGYwTUz3SaF/XqAO6Px4Gpsz1FKTTpepS2FZ5fl9SL8Z+ kdn8KT0W4ZgJPBrWVLZ6/yhL+HVLomLR9/o69rJsPmkfXufck18yuTXPEcR0MgJ0z/ Bo93Cv2DhKsME2gAVS9YVXOUyPrpHtqK0Ck2eEI8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Arnd Bergmann , Jason Wessel Subject: [PATCH 3.18 21/54] kdb: use memmove instead of overlapping memcpy Date: Tue, 11 Dec 2018 16:41:09 +0100 Message-Id: <20181211151547.164995847@linuxfoundation.org> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20181211151546.010073210@linuxfoundation.org> References: <20181211151546.010073210@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 3.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Arnd Bergmann commit 2cf2f0d5b91fd1b06a6ae260462fc7945ea84add upstream. gcc discovered that the memcpy() arguments in kdbnearsym() overlap, so we should really use memmove(), which is defined to handle that correctly: In function 'memcpy', inlined from 'kdbnearsym' at /git/arm-soc/kernel/debug/kdb/kdb_support.c:132:4: /git/arm-soc/include/linux/string.h:353:9: error: '__builtin_memcpy' accessing 792 bytes at offsets 0 and 8 overlaps 784 bytes at offset 8 [-Werror=restrict] return __builtin_memcpy(p, q, size); Signed-off-by: Arnd Bergmann Signed-off-by: Jason Wessel Signed-off-by: Greg Kroah-Hartman --- kernel/debug/kdb/kdb_support.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/kernel/debug/kdb/kdb_support.c +++ b/kernel/debug/kdb/kdb_support.c @@ -129,13 +129,13 @@ int kdbnearsym(unsigned long addr, kdb_s } if (i >= ARRAY_SIZE(kdb_name_table)) { debug_kfree(kdb_name_table[0]); - memcpy(kdb_name_table, kdb_name_table+1, + memmove(kdb_name_table, kdb_name_table+1, sizeof(kdb_name_table[0]) * (ARRAY_SIZE(kdb_name_table)-1)); } else { debug_kfree(knt1); knt1 = kdb_name_table[i]; - memcpy(kdb_name_table+i, kdb_name_table+i+1, + memmove(kdb_name_table+i, kdb_name_table+i+1, sizeof(kdb_name_table[0]) * (ARRAY_SIZE(kdb_name_table)-i-1)); }