]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
powerpc/pseries: Add failure related checks for h_get_mpp and h_get_ppp
authorShrikanth Hegde <sshegde@linux.ibm.com>
Fri, 12 Apr 2024 09:20:47 +0000 (14:50 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 16 Jun 2024 11:28:44 +0000 (13:28 +0200)
[ Upstream commit 6d4341638516bf97b9a34947e0bd95035a8230a5 ]

Couple of Minor fixes:

- hcall return values are long. Fix that for h_get_mpp, h_get_ppp and
parse_ppp_data

- If hcall fails, values set should be at-least zero. It shouldn't be
uninitialized values. Fix that for h_get_mpp and h_get_ppp

Signed-off-by: Shrikanth Hegde <sshegde@linux.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://msgid.link/20240412092047.455483-3-sshegde@linux.ibm.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
arch/powerpc/include/asm/hvcall.h
arch/powerpc/platforms/pseries/lpar.c
arch/powerpc/platforms/pseries/lparcfg.c

index 11112023e327d7ccc695323545d396f5aadf49fd..0826c4ed837705f00df8e7fd950916eac82ab3bd 100644 (file)
@@ -444,7 +444,7 @@ struct hvcall_mpp_data {
        unsigned long backing_mem;
 };
 
-int h_get_mpp(struct hvcall_mpp_data *);
+long h_get_mpp(struct hvcall_mpp_data *mpp_data);
 
 struct hvcall_mpp_x_data {
        unsigned long coalesced_bytes;
index 52e466d4a33ca244a836296b074c32ddcf16a92c..d5700ef27e36c60872ad5a8650af637cae4c3d82 100644 (file)
@@ -1871,10 +1871,10 @@ out:
  * h_get_mpp
  * H_GET_MPP hcall returns info in 7 parms
  */
-int h_get_mpp(struct hvcall_mpp_data *mpp_data)
+long h_get_mpp(struct hvcall_mpp_data *mpp_data)
 {
-       int rc;
-       unsigned long retbuf[PLPAR_HCALL9_BUFSIZE];
+       unsigned long retbuf[PLPAR_HCALL9_BUFSIZE] = {0};
+       long rc;
 
        rc = plpar_hcall9(H_GET_MPP, retbuf);
 
index e12cf62357f2945834b28849d73afe9bcfb0117b..676a60927dad90c179a51d8aa7807f0a2b8bf09a 100644 (file)
@@ -112,8 +112,8 @@ struct hvcall_ppp_data {
  */
 static unsigned int h_get_ppp(struct hvcall_ppp_data *ppp_data)
 {
-       unsigned long rc;
-       unsigned long retbuf[PLPAR_HCALL9_BUFSIZE];
+       unsigned long retbuf[PLPAR_HCALL9_BUFSIZE] = {0};
+       long rc;
 
        rc = plpar_hcall9(H_GET_PPP, retbuf);
 
@@ -159,7 +159,7 @@ static void parse_ppp_data(struct seq_file *m)
        struct hvcall_ppp_data ppp_data;
        struct device_node *root;
        const __be32 *perf_level;
-       int rc;
+       long rc;
 
        rc = h_get_ppp(&ppp_data);
        if (rc)