Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp1437549imm; Wed, 25 Jul 2018 18:47:57 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcAMLS0I5dcRg2iQ45I0xIM4rk6ks0Hfru3qgHobIknud9qq/6HO/O7ns+mT7f6cqKXpzEV X-Received: by 2002:a17:902:8d91:: with SMTP id v17-v6mr23485501plo.9.1532569677497; Wed, 25 Jul 2018 18:47:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532569677; cv=none; d=google.com; s=arc-20160816; b=XQQN99sLinXS+UL2RImtlCLaE2Zjn2ggGe0fDgVy/nWOY/VMSTYbvIZAIb8CA4rXWx Prhp15e2KmhzJIKH26NfYbYMx7PBxitK9uH0ZFJK0OzBX4hSYydTUsPR920GPbtROTGD KzdlRmUNGX4wRlTpe8SBNamBgXYVQHGF9MfxuSMsvjKzV5aUCaMYoJyeikdBUVTik37T vKqGkYqvJHVLqVXzD5DrpGLLubsPydBOtFm7xX84VgTzama0tnYv7dd8dZ4tKv0dKdaf ml/T52fs+H3Ub5oTlPUVhNjUECXnceyAoVXDNcA1lWjwc55kjQppk9MgQljbEpr8AALj /H2Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=azGIAqjhubvPhiTxDMeOWSUNh8NUi3e8ryLgN8ahl9w=; b=P3QvCtsG9hfcMPVRd/cNJQpGZEYT6eRMbCXYqJXiiQMupu1wqmaER3QWpdNJlnRcp/ h0lW2EidPDPRZ0HBJN0Lb8sDJNXb+AzfhhD45cCEYQKMwHuWtqH+iltN3W8MgzbTMHlF ZM51T/WRaJ00ErT3S66xj1aRioQ92HdkrilUFHLVgcb1dp9tTY7Xo2IW2kjbtsELkAGz yhYHl4hM0SErtPVjbvJIcba5OykQFN4MWoE9Si4ztpc82baYBGcKbp3WAtQsB91QHHIs vosbnhNr98tJrNhp4h9y37W21RYltd30jcF/5na8HUMNSkkyn7Pag2zjZJwDF1lVeeZK nr4Q== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=canonical.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d10-v6si16942pfg.258.2018.07.25.18.47.42; Wed, 25 Jul 2018 18:47:57 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=canonical.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728777AbeGZDBP (ORCPT + 99 others); Wed, 25 Jul 2018 23:01:15 -0400 Received: from youngberry.canonical.com ([91.189.89.112]:38301 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728716AbeGZDBO (ORCPT ); Wed, 25 Jul 2018 23:01:14 -0400 Received: from mail-qk0-f200.google.com ([209.85.220.200]) by youngberry.canonical.com with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.76) (envelope-from ) id 1fiVMf-0005fH-6i for linux-kernel@vger.kernel.org; Thu, 26 Jul 2018 01:46:49 +0000 Received: by mail-qk0-f200.google.com with SMTP id w126-v6so104814qka.11 for ; Wed, 25 Jul 2018 18:46:49 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=azGIAqjhubvPhiTxDMeOWSUNh8NUi3e8ryLgN8ahl9w=; b=ERy8XdnmglYL7uXC02scfmhtnO9LnVlS7wOErr+tpp9ajoXmseUYuMbGIBokJpifWI OVhrmPwA1k+JNMUExoZAFimKixxbB3Lrgtu+TqRTukdFoTb1gF//c1P0sw5bZSJA5L0v N/Em06PCuJ2aumSmGJyHoDHpDZJl5g3wfhNDq/r+r8HgAZFYmCD245DdTzNPgdYi4nzz wFX8gbr0qGo/d9AuS3WEtTaI7HvmCCQ2wu6IvuJmbI8In6bYibYq3WXm9bRRrD2rpO/T ehDG1h7NPRMKOQ6CrJcog9+7R6BJvXbi1ic9sASn8TEVqEFaBRa25fQ5jUoVH+YGmRgj czcQ== X-Gm-Message-State: AOUpUlGeB0/NEdvuIJ4EJH734gkjx0KsWQmmsYIaXTm4ifi3q4SI3XP0 N5jd2169LztZzGxSAvkWfRPupqKB1uwuEDKVpn4h5i9Sv9POvGvZZA4Y+ZT67AG6hsmIJZVkIvq qAY5BV1CvOp5VSrDXqCvBqlVjtNC+d6WZx+Ez7sxHHQ== X-Received: by 2002:a37:6a82:: with SMTP id f124-v6mr21434410qkc.296.1532569608417; Wed, 25 Jul 2018 18:46:48 -0700 (PDT) X-Received: by 2002:a37:6a82:: with SMTP id f124-v6mr21434399qkc.296.1532569608260; Wed, 25 Jul 2018 18:46:48 -0700 (PDT) Received: from localhost.localdomain ([2804:14c:482:77dd:8111:28ad:fd9c:9a4d]) by smtp.gmail.com with ESMTPSA id r4-v6sm19619qtm.10.2018.07.25.18.46.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 25 Jul 2018 18:46:47 -0700 (PDT) From: Mauricio Faria de Oliveira To: axboe@kernel.dk Cc: phdm@macqel.be, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, daniel.axtens@canonical.com Subject: [PATCH 2/2] partitions/aix: append null character to print data from disk Date: Wed, 25 Jul 2018 22:46:29 -0300 Message-Id: <20180726014629.30411-3-mfo@canonical.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180726014629.30411-1-mfo@canonical.com> References: <20180726014629.30411-1-mfo@canonical.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- block/partitions/aix.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/block/partitions/aix.c b/block/partitions/aix.c index 850cbd1860d4..903f3ed175d0 100644 --- a/block/partitions/aix.c +++ b/block/partitions/aix.c @@ -283,10 +283,14 @@ int aix_partition(struct parsed_partitions *state) 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); -- 2.17.1