soc: qcom: smem: Use le32_to_cpu for comparison
authorChris Lew <clew@codeaurora.org>
Tue, 21 Apr 2020 12:40:15 +0000 (13:40 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 24 Apr 2020 05:59:10 +0000 (07:59 +0200)
[ Upstream commit a216000f0140f415cec96129f777b5234c9d142f ]

Endianness can vary in the system, add le32_to_cpu when comparing
partition sizes from smem.

Signed-off-by: Chris Lew <clew@codeaurora.org>
Acked-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Signed-off-by: Andy Gross <andy.gross@linaro.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/soc/qcom/smem.c

index 18ec52f2078aab2b27d0675ced0158908b4275ea..89dd50fa404f7bdda0dc2e60c815dfd1cb329b0a 100644 (file)
@@ -646,7 +646,7 @@ static int qcom_smem_enumerate_partitions(struct qcom_smem *smem,
                        return -EINVAL;
                }
 
-               if (header->size != entry->size) {
+               if (le32_to_cpu(header->size) != le32_to_cpu(entry->size)) {
                        dev_err(smem->dev,
                                "Partition %d has invalid size\n", i);
                        return -EINVAL;