From patchwork Wed Aug 15 20:58:15 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauricio Faria de Oliveira X-Patchwork-Id: 960551 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=canonical.com Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 41vxPX5b6pz9s7X; Wed, 22 Aug 2018 02:45:36 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1fs9mZ-0002xi-LO; Tue, 21 Aug 2018 16:45:27 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by huckleberry.canonical.com with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.86_2) (envelope-from ) id 1fq2sF-0000K1-L8 for kernel-team@lists.ubuntu.com; Wed, 15 Aug 2018 20:58:35 +0000 Received: from mail-qt0-f198.google.com ([209.85.216.198]) by youngberry.canonical.com with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.76) (envelope-from ) id 1fq2sF-0002Ta-BT for kernel-team@lists.ubuntu.com; Wed, 15 Aug 2018 20:58:35 +0000 Received: by mail-qt0-f198.google.com with SMTP id z6-v6so1962844qto.4 for ; Wed, 15 Aug 2018 13:58:35 -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:subject:date:message-id:in-reply-to :references; bh=00rLUXHQljQw192Q4G695XqmoL5sduBL15+QZOnpXYQ=; b=jN1z80s4uV5o3vKp3969ELVFuUmZIYjmkxo1IpZ+jOgmJiwlPv/vUfIAPreVgVLs1G m7CuxD51IoAiiAAf8EnwqdP/w/p0rT5ky8NwQEWKLEm32c2LESu/OvgnRFEPh8L48tLg L1Xm4g9KwZWIn6eXJR1eVh9cnwLJ7i1LVnjGmIfY6aINb/dBSqBpwRzyj1A4S7CxJ3pN oBT6/6G7zkXIwW+iZV9UDOIxsaE3R4arMDHNCdTK4iUXgbILd8lTqJVkjAlI0ZcewGl0 SUSR/yCLqE1rnj/0d3akMcGgqsyhahdZx0GQbY+z7bVBdvdtAfp7VUkI1lddBhLJr9m5 SvRQ== X-Gm-Message-State: AOUpUlGkd3tsZ0X9JNeRjr21d9ny9cE8DXcx1gt3jKJNlbS/T62Zlmrz om3X6RN9yFxwttM9Yof8lQJS+8AFzSuFcp6Gtza65R8LqvWgGx/2Q8Cdck9jbFDR+Te08ieCbdW vaRSv9CA0YQmhODlc8va8y3qSirhHx1BbcRPIMNpPbA== X-Received: by 2002:a37:a310:: with SMTP id m16-v6mr26246157qke.254.1534366714358; Wed, 15 Aug 2018 13:58:34 -0700 (PDT) X-Google-Smtp-Source: AA+uWPx1ZdrBZyOP61Z2tbr5ShqHDDdbligeU9HeaVY3hxv2D+c3C6AjIeNhOrIJWSeoq+sGhe3iBQ== X-Received: by 2002:a37:a310:: with SMTP id m16-v6mr26246150qke.254.1534366714201; Wed, 15 Aug 2018 13:58:34 -0700 (PDT) Received: from localhost.localdomain ([2804:14c:482:77dd:755a:ff85:9f62:6fb1]) by smtp.gmail.com with ESMTPSA id c11-v6sm14157290qkb.22.2018.08.15.13.58.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 15 Aug 2018 13:58:33 -0700 (PDT) From: Mauricio Faria de Oliveira To: kernel-team@lists.ubuntu.com Subject: [PATCH 2/2] partitions/aix: append null character to print data from disk Date: Wed, 15 Aug 2018 17:58:15 -0300 Message-Id: <20180815205815.18380-3-mfo@canonical.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180815205815.18380-1-mfo@canonical.com> References: <20180815205815.18380-1-mfo@canonical.com> X-Mailman-Approved-At: Tue, 21 Aug 2018 16:45:26 +0000 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" BugLink: https://bugs.launchpad.net/bugs/1787281 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 (cherry picked from commit d43fdae7bac2def8c4314b5a49822cb7f08a45f1) 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);