Message ID | 20171212093910.21743-1-mashimiao.fnst@cn.fujitsu.com (mailing list archive) |
---|---|
State | Accepted, archived |
Delegated to: | Mike Snitzer |
Headers | show
Return-Path: <dm-devel-bounces@redhat.com> Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id D2589602C2 for <patchwork-dm-devel@patchwork.kernel.org>; Tue, 12 Dec 2017 10:34:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C804329B51 for <patchwork-dm-devel@patchwork.kernel.org>; Tue, 12 Dec 2017 10:34:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BC69C29B72; Tue, 12 Dec 2017 10:34:22 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 59F5729B51 for <patchwork-dm-devel@patchwork.kernel.org>; Tue, 12 Dec 2017 10:34:22 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7DEFE81DF7; Tue, 12 Dec 2017 10:34:21 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5F46D68D86; Tue, 12 Dec 2017 10:34:21 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 316AB1800FC5; Tue, 12 Dec 2017 10:34:21 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id vBC9mj4u013746 for <dm-devel@listman.util.phx.redhat.com>; Tue, 12 Dec 2017 04:48:46 -0500 Received: by smtp.corp.redhat.com (Postfix) id EEDD16062D; Tue, 12 Dec 2017 09:48:45 +0000 (UTC) Delivered-To: dm-devel@redhat.com Received: from mx1.redhat.com (ext-mx03.extmail.prod.ext.phx2.redhat.com [10.5.110.27]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 628D460633; Tue, 12 Dec 2017 09:48:42 +0000 (UTC) Received: from heian.cn.fujitsu.com (mail.cn.fujitsu.com [183.91.158.132]) by mx1.redhat.com (Postfix) with ESMTP id 27FB36A7CB; Tue, 12 Dec 2017 09:48:40 +0000 (UTC) X-IronPort-AV: E=Sophos;i="5.43,368,1503331200"; d="scan'208";a="31263144" Received: from localhost (HELO cn.fujitsu.com) ([10.167.33.5]) by heian.cn.fujitsu.com with ESMTP; 12 Dec 2017 17:38:18 +0800 Received: from G08CNEXCHPEKD03.g08.fujitsu.local (unknown [10.167.33.85]) by cn.fujitsu.com (Postfix) with ESMTP id 1A29448AE827; Tue, 12 Dec 2017 17:38:17 +0800 (CST) Received: from G08FNSTD121139.g08.fujitsu.local (10.167.225.93) by G08CNEXCHPEKD03.g08.fujitsu.local (10.167.33.89) with Microsoft SMTP Server (TLS) id 14.3.361.1; Tue, 12 Dec 2017 17:38:15 +0800 From: Ma Shimiao <mashimiao.fnst@cn.fujitsu.com> To: <agk@redhat.com>, <snitzer@redhat.com>, <dm-devel@redhat.com> Date: Tue, 12 Dec 2017 17:39:10 +0800 Message-ID: <20171212093910.21743-1-mashimiao.fnst@cn.fujitsu.com> MIME-Version: 1.0 X-Originating-IP: [10.167.225.93] X-yoursite-MailScanner-ID: 1A29448AE827.AA3C3 X-yoursite-MailScanner: Found to be clean X-yoursite-MailScanner-From: mashimiao.fnst@cn.fujitsu.com X-Greylist: Delayed for 00:10:20 by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Tue, 12 Dec 2017 09:48:41 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Tue, 12 Dec 2017 09:48:41 +0000 (UTC) for IP:'183.91.158.132' DOMAIN:'mail.cn.fujitsu.com' HELO:'heian.cn.fujitsu.com' FROM:'mashimiao.fnst@cn.fujitsu.com' RCPT:'' X-RedHat-Spam-Score: -0.01 (T_RP_MATCHES_RCVD) 183.91.158.132 mail.cn.fujitsu.com 183.91.158.132 mail.cn.fujitsu.com <mashimiao.fnst@cn.fujitsu.com> X-Scanned-By: MIMEDefang 2.78 on 10.5.110.27 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: dm-devel@redhat.com X-Mailman-Approved-At: Tue, 12 Dec 2017 05:34:08 -0500 Cc: linux-kernel@vger.kernel.org, Ma Shimiao <mashimiao.fnst@cn.fujitsu.com> Subject: [dm-devel] [PATCH] drviers/md: fix max dup length for kstrndup X-BeenThere: dm-devel@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: device-mapper development <dm-devel.redhat.com> List-Unsubscribe: <https://www.redhat.com/mailman/options/dm-devel>, <mailto:dm-devel-request@redhat.com?subject=unsubscribe> List-Archive: <https://www.redhat.com/archives/dm-devel> List-Post: <mailto:dm-devel@redhat.com> List-Help: <mailto:dm-devel-request@redhat.com?subject=help> List-Subscribe: <https://www.redhat.com/mailman/listinfo/dm-devel>, <mailto:dm-devel-request@redhat.com?subject=subscribe> Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Tue, 12 Dec 2017 10:34:21 +0000 (UTC) X-Virus-Scanned: ClamAV using ClamSMTP |
diff --git a/drivers/md/dm-log-writes.c b/drivers/md/dm-log-writes.c index 189badbeddaf..3362d866793b 100644 --- a/drivers/md/dm-log-writes.c +++ b/drivers/md/dm-log-writes.c @@ -594,7 +594,7 @@ static int log_mark(struct log_writes_c *lc, char *data) return -ENOMEM; } - block->data = kstrndup(data, maxsize, GFP_KERNEL); + block->data = kstrndup(data, maxsize - 1, GFP_KERNEL); if (!block->data) { DMERR("Error copying mark data"); kfree(block);
If source string longer than max, kstrndup will alloc max+1 space. So, we should make sure the result will not over limit. Signed-off-by: Ma Shimiao <mashimiao.fnst@cn.fujitsu.com> --- drivers/md/dm-log-writes.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)