Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp4537802imm; Mon, 17 Sep 2018 16:05:59 -0700 (PDT) X-Google-Smtp-Source: ANB0Vda+RGuQ+8SR2/oNmFUpQbLI0gB6rHYaUWS5OAeFLa2LkbfKgpJyLxg8tZuobuI1pt0nVJ8x X-Received: by 2002:a63:df4e:: with SMTP id h14-v6mr25125546pgj.300.1537225559157; Mon, 17 Sep 2018 16:05:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537225559; cv=none; d=google.com; s=arc-20160816; b=a7tMh36VQ4cevRF70Xk5yR3hVAlCX+o6VItzio1x4vjqx8ofMZF62PjxHD74U6kNGC zqLozgYGzuWbgUTokT9uTYcslAmDtHds133RIgrZBI0CtYaUE+RJJikPjrRNGiAI8/D7 VQhx0HFea4F0PA4zZUEy/lZ69GkjnILbOZ4DenTIYFNZ/lW2GRxCsDbuJhUmyeHgPrsU 2eCdNIUAXTp5SeodjSTybYXahBDNSw4liDy5Uy01z3Xfv/Zj92ottnaqiq9yQT0wAwO3 YXFMQZzedSxYH9Oap6wwxOc3nKcbx2aWIu0GY5bs22IeximS6a8wBHOvGDGO2fqfKEWD odJw== 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; bh=3xf5hYu018kLdJ9TaDtTg573GDcGZDwv0tZzVgLzCrg=; b=LCIO1huO0SrJJoFTcQxWqQRzaBZyn3H50fbVCCPhRB+T20wh/tRZ5C4ZBNNpjD4yeK eGg/9BYAoAEREhBFpQtptXfYP1J5Ex2K8eIh+OIEefFdUrfKYsNJiaLn9tMPvcm3o3Le HyhNNgp4mic4LyLiCciK4xEKWM+tWYFXx9v1Yy2TPgb1YUnkfiLx8VS/qlC7DFw3gmyr fw83GS9pI19gc+sMOWU9Bmu4QDKZz7+cRTqMAr1VEYhadxhSYPYz7AZuOqM8yMnJR3R+ Z5BCOxJiEzCdaySMan9HKBMSTkH4scojvOVxrsS9K2uO6WMpseWAZ9jHIcALCKkTZUbu UHIQ== ARC-Authentication-Results: i=1; mx.google.com; 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 z123-v6si18229731pfc.289.2018.09.17.16.05.44; Mon, 17 Sep 2018 16:05:59 -0700 (PDT) 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; 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 S1730794AbeIREdr (ORCPT + 99 others); Tue, 18 Sep 2018 00:33:47 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:49100 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727202AbeIREdq (ORCPT ); Tue, 18 Sep 2018 00:33:46 -0400 Received: from localhost (li1825-44.members.linode.com [172.104.248.44]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id BC22BC49; Mon, 17 Sep 2018 23:04:17 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Daniel J. Axtens" , Mauricio Faria de Oliveira , Jens Axboe , Sasha Levin Subject: [PATCH 4.14 080/126] partitions/aix: append null character to print data from disk Date: Tue, 18 Sep 2018 00:42:08 +0200 Message-Id: <20180917211709.398570651@linuxfoundation.org> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20180917211703.481236999@linuxfoundation.org> References: <20180917211703.481236999@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review 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 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Mauricio Faria de Oliveira [ Upstream commit d43fdae7bac2def8c4314b5a49822cb7f08a45f1 ] Even if properly initialized, the lvname array (i.e., strings) is read from disk, and might contain corrupt data (e.g., lack the null terminating character for strings). So, make sure the partition name string used in pr_warn() has the null terminating character. Fixes: 6ceea22bbbc8 ("partitions: add aix lvm partition support files") Suggested-by: Daniel J. Axtens Signed-off-by: Mauricio Faria de Oliveira Signed-off-by: Jens Axboe Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- block/partitions/aix.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) --- a/block/partitions/aix.c +++ b/block/partitions/aix.c @@ -282,10 +282,14 @@ int aix_partition(struct parsed_partitio next_lp_ix += 1; } for (i = 0; i < state->limit; i += 1) - if (lvip[i].pps_found && !lvip[i].lv_is_contiguous) + if (lvip[i].pps_found && !lvip[i].lv_is_contiguous) { + char tmp[sizeof(n[i].name) + 1]; // null char + + snprintf(tmp, sizeof(tmp), "%s", n[i].name); pr_warn("partition %s (%u pp's found) is " "not contiguous\n", - n[i].name, lvip[i].pps_found); + tmp, lvip[i].pps_found); + } kfree(pvd); } kfree(n);