Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp572101imm; Fri, 21 Sep 2018 05:00:09 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZtNeE22ZnHrMFYWI11BzgumALcRWwEVgAMAaJKg+4kg86mVbJalxDHiNLzmYhwnrdXRoez X-Received: by 2002:a17:902:1101:: with SMTP id d1-v6mr44812613pla.131.1537531209928; Fri, 21 Sep 2018 05:00:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537531209; cv=none; d=google.com; s=arc-20160816; b=SUgUOi8MtrgDNwSCC1UBzfiz0Yh/6x0i8PUUtIJaraMJwUWv31gkXXRIqs0ICrW42X TIiwJzZQiSCzN7OXqXP8jYvH3U4W8+MbNQSrF/Q4bmymVfhZZR7uduoxvvoyUtGJJimE 5KEQ2Lq7IWkbD9nq7XxuDe/iwchZVjzTxSSUvkjNt7fH3VtU40ri7nzyB4bqgDXvA7Mz DB+SnX3ArtHMm4yjzQIBlJ2yasJvuVcVIg2/PY61Txpri5f8vHoZgP4JX4Ygy22idvFp rnX5efEGE5tL9oP8tzHeXuUjZNgYkd3CmUvBuAgBUsViXmtJ8Geb6K/izDgXIXL47Jhq W/Eg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:date:message-id:subject:cc:from:to :in-reply-to; bh=bKBCL4W2Y4r9ytjZcbFDls79ex88owGdg2w/igF2aTM=; b=l+80w7JSBBTWfy3kn6uR4P+nsoQLNYLYOS/StZwIjvMPjRnzf6dtd3T3QmOcQsChLJ X1iUaSaM0fTXmc292ZrIp/yk2V/sEOHBvse0ZysuBFxl5mNC3tRRy4k1KlgkZMfcPsn7 4ceAeYMGz4Qn4Vm8J6kWxOeaycjyV5t+rwL0gU0FlmTHsEHdaFhUAjqK8BKjx7Gv4jjr mmGsYo6mn4wcBRnTaUFGIAOtPxGJpJAuxA72q5I9sgcL+AwXd/IIAAi3ef0bZ7fD2VJx HvFjZarXVWw/jNfsuz3iy1Io6HVCQKS1NfHMUXqsHzBatJVyyM+Bj5L95KF4SVL2fU6f U5qA== 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 f91-v6si26927883plf.376.2018.09.21.04.59.54; Fri, 21 Sep 2018 05:00:09 -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 S2390025AbeIURsQ (ORCPT + 99 others); Fri, 21 Sep 2018 13:48:16 -0400 Received: from ozlabs.org ([203.11.71.1]:35897 "EHLO ozlabs.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389873AbeIURsP (ORCPT ); Fri, 21 Sep 2018 13:48:15 -0400 Received: by ozlabs.org (Postfix, from userid 1034) id 42GsbJ6bPwz9sC7; Fri, 21 Sep 2018 21:59:40 +1000 (AEST) X-powerpc-patch-notification: thanks X-powerpc-patch-commit: c716a25b9b70084e1144f77423f5aedd772ea478 In-Reply-To: <20180920043858.28773-1-bauerman@linux.ibm.com> To: Thiago Jung Bauermann , linuxppc-dev@lists.ozlabs.org From: Michael Ellerman Cc: Ram Pai , linux-kernel@vger.kernel.org, Thiago Jung Bauermann Subject: Re: powerpc/pkeys: Fix reading of ibm, processor-storage-keys property Message-Id: <42GsbJ6bPwz9sC7@ozlabs.org> Date: Fri, 21 Sep 2018 21:59:40 +1000 (AEST) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 2018-09-20 at 04:38:58 UTC, Thiago Jung Bauermann wrote: > scan_pkey_feature() uses of_property_read_u32_array() to read the > ibm,processor-storage-keys property and calls be32_to_cpu() on the > value it gets. The problem is that of_property_read_u32_array() already > returns the value converted to the CPU byte order. > > The value of pkeys_total ends up more or less sane because there's a min() > call in pkey_initialize() which reduces pkeys_total to 32. So in practice > the kernel ignores the fact that the hypervisor reserved one key for > itself (the device tree advertises 31 keys in my test VM). > > This is wrong, but the effect in practice is that when a process tries to > allocate the 32nd key, it gets an -EINVAL error instead of -ENOSPC which > would indicate that there aren't any keys available > > Fixes: cf43d3b26452 ("powerpc: Enable pkey subsystem") > Signed-off-by: Thiago Jung Bauermann Applied to powerpc fixes, thanks. https://git.kernel.org/powerpc/c/c716a25b9b70084e1144f77423f5ae cheers