X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;f=kernel%2Fdrivers%2Fof%2Faddress.c;h=9582c5703b3c905486da173d08a2f986883bda26;hb=59ee691ba40e67e4975e0eaf768efb6df286ed3c;hp=384574c3987c337444181d68346ce9d95963f027;hpb=c933c04f811030b46a60d7e20dad4599de49963f;p=kvmfornfv.git diff --git a/kernel/drivers/of/address.c b/kernel/drivers/of/address.c index 384574c39..9582c5703 100644 --- a/kernel/drivers/of/address.c +++ b/kernel/drivers/of/address.c @@ -330,6 +330,12 @@ int of_pci_range_to_resource(struct of_pci_range *range, } res->start = port; } else { + if ((sizeof(resource_size_t) < 8) && + upper_32_bits(range->cpu_addr)) { + err = -EINVAL; + goto invalid_range; + } + res->start = range->cpu_addr; } res->end = res->start + range->size - 1; @@ -479,9 +485,10 @@ static int of_translate_one(struct device_node *parent, struct of_bus *bus, int rone; u64 offset = OF_BAD_ADDR; - /* Normally, an absence of a "ranges" property means we are + /* + * Normally, an absence of a "ranges" property means we are * crossing a non-translatable boundary, and thus the addresses - * below the current not cannot be converted to CPU physical ones. + * below the current cannot be converted to CPU physical ones. * Unfortunately, while this is very clear in the spec, it's not * what Apple understood, and they do have things like /uni-n or * /ht nodes with no "ranges" property and a lot of perfectly