diff options
author | David Hildenbrand <dahi@linux.vnet.ibm.com> | 2016-05-09 05:22:34 -0400 |
---|---|---|
committer | Christian Borntraeger <borntraeger@de.ibm.com> | 2016-06-10 06:07:28 -0400 |
commit | 154c8c19c35b6da94a623cb793458e203572083d (patch) | |
tree | 9ca37ad9fa34d1495bb1c770b035192c87a15854 /arch/s390/mm | |
parent | 8d6037a7b4f21708451d4aec14828f9ebe77b37a (diff) |
s390/mm: return key via pointer in get_guest_storage_key
Let's just split returning the key and reporting errors. This makes calling
code easier and avoids bugs as happened already.
Reviewed-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: David Hildenbrand <dahi@linux.vnet.ibm.com>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Diffstat (limited to 'arch/s390/mm')
-rw-r--r-- | arch/s390/mm/pgtable.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/arch/s390/mm/pgtable.c b/arch/s390/mm/pgtable.c index 4c8d572d59cc..3e35298758d6 100644 --- a/arch/s390/mm/pgtable.c +++ b/arch/s390/mm/pgtable.c | |||
@@ -539,9 +539,9 @@ int set_guest_storage_key(struct mm_struct *mm, unsigned long addr, | |||
539 | } | 539 | } |
540 | EXPORT_SYMBOL(set_guest_storage_key); | 540 | EXPORT_SYMBOL(set_guest_storage_key); |
541 | 541 | ||
542 | unsigned long get_guest_storage_key(struct mm_struct *mm, unsigned long addr) | 542 | int get_guest_storage_key(struct mm_struct *mm, unsigned long addr, |
543 | unsigned char *key) | ||
543 | { | 544 | { |
544 | unsigned char key; | ||
545 | spinlock_t *ptl; | 545 | spinlock_t *ptl; |
546 | pgste_t pgste; | 546 | pgste_t pgste; |
547 | pte_t *ptep; | 547 | pte_t *ptep; |
@@ -551,14 +551,14 @@ unsigned long get_guest_storage_key(struct mm_struct *mm, unsigned long addr) | |||
551 | return -EFAULT; | 551 | return -EFAULT; |
552 | 552 | ||
553 | pgste = pgste_get_lock(ptep); | 553 | pgste = pgste_get_lock(ptep); |
554 | key = (pgste_val(pgste) & (PGSTE_ACC_BITS | PGSTE_FP_BIT)) >> 56; | 554 | *key = (pgste_val(pgste) & (PGSTE_ACC_BITS | PGSTE_FP_BIT)) >> 56; |
555 | if (!(pte_val(*ptep) & _PAGE_INVALID)) | 555 | if (!(pte_val(*ptep) & _PAGE_INVALID)) |
556 | key = page_get_storage_key(pte_val(*ptep) & PAGE_MASK); | 556 | *key = page_get_storage_key(pte_val(*ptep) & PAGE_MASK); |
557 | /* Reflect guest's logical view, not physical */ | 557 | /* Reflect guest's logical view, not physical */ |
558 | key |= (pgste_val(pgste) & (PGSTE_GR_BIT | PGSTE_GC_BIT)) >> 48; | 558 | *key |= (pgste_val(pgste) & (PGSTE_GR_BIT | PGSTE_GC_BIT)) >> 48; |
559 | pgste_set_unlock(ptep, pgste); | 559 | pgste_set_unlock(ptep, pgste); |
560 | pte_unmap_unlock(ptep, ptl); | 560 | pte_unmap_unlock(ptep, ptl); |
561 | return key; | 561 | return 0; |
562 | } | 562 | } |
563 | EXPORT_SYMBOL(get_guest_storage_key); | 563 | EXPORT_SYMBOL(get_guest_storage_key); |
564 | #endif | 564 | #endif |