| .. | .. |
|---|
| 12 | 12 | * Fix bug in inverse translation. Stanislav Voronyi <stas@cnti.uanet.kharkov.ua>, Dec 1998 |
|---|
| 13 | 13 | * |
|---|
| 14 | 14 | * In order to prevent the following circular lock dependency: |
|---|
| 15 | | - * &mm->mmap_sem --> cpu_hotplug.lock --> console_lock --> &mm->mmap_sem |
|---|
| 15 | + * &mm->mmap_lock --> cpu_hotplug.lock --> console_lock --> &mm->mmap_lock |
|---|
| 16 | 16 | * |
|---|
| 17 | 17 | * We cannot allow page fault to happen while holding the console_lock. |
|---|
| 18 | 18 | * Therefore, all the userspace copy operations have to be done outside |
|---|
| .. | .. |
|---|
| 268 | 268 | * was active. |
|---|
| 269 | 269 | * Still, it is now possible to a certain extent to cut and paste non-ASCII. |
|---|
| 270 | 270 | */ |
|---|
| 271 | | -u16 inverse_translate(struct vc_data *conp, int glyph, int use_unicode) |
|---|
| 271 | +u16 inverse_translate(const struct vc_data *conp, int glyph, int use_unicode) |
|---|
| 272 | 272 | { |
|---|
| 273 | 273 | struct uni_pagedir *p; |
|---|
| 274 | 274 | int m; |
|---|
| .. | .. |
|---|
| 542 | 542 | if (!ct) |
|---|
| 543 | 543 | return 0; |
|---|
| 544 | 544 | |
|---|
| 545 | | - unilist = memdup_user(list, ct * sizeof(struct unipair)); |
|---|
| 545 | + unilist = vmemdup_user(list, array_size(sizeof(struct unipair), ct)); |
|---|
| 546 | 546 | if (IS_ERR(unilist)) |
|---|
| 547 | 547 | return PTR_ERR(unilist); |
|---|
| 548 | 548 | |
|---|
| .. | .. |
|---|
| 641 | 641 | |
|---|
| 642 | 642 | out_unlock: |
|---|
| 643 | 643 | console_unlock(); |
|---|
| 644 | | - kfree(unilist); |
|---|
| 644 | + kvfree(unilist); |
|---|
| 645 | 645 | return err; |
|---|
| 646 | 646 | } |
|---|
| 647 | 647 | |
|---|
| .. | .. |
|---|
| 708 | 708 | /** |
|---|
| 709 | 709 | * con_copy_unimap - copy unimap between two vts |
|---|
| 710 | 710 | * @dst_vc: target |
|---|
| 711 | | - * @src_vt: source |
|---|
| 711 | + * @src_vc: source |
|---|
| 712 | 712 | * |
|---|
| 713 | 713 | * The caller must hold the console lock when invoking this method |
|---|
| 714 | 714 | */ |
|---|
| .. | .. |
|---|
| 743 | 743 | struct uni_pagedir *p; |
|---|
| 744 | 744 | struct unipair *unilist; |
|---|
| 745 | 745 | |
|---|
| 746 | | - unilist = kmalloc_array(ct, sizeof(struct unipair), GFP_KERNEL); |
|---|
| 746 | + unilist = kvmalloc_array(ct, sizeof(struct unipair), GFP_KERNEL); |
|---|
| 747 | 747 | if (!unilist) |
|---|
| 748 | 748 | return -ENOMEM; |
|---|
| 749 | 749 | |
|---|
| .. | .. |
|---|
| 775 | 775 | if (copy_to_user(list, unilist, min(ect, ct) * sizeof(struct unipair))) |
|---|
| 776 | 776 | ret = -EFAULT; |
|---|
| 777 | 777 | put_user(ect, uct); |
|---|
| 778 | | - kfree(unilist); |
|---|
| 778 | + kvfree(unilist); |
|---|
| 779 | 779 | return ret ? ret : (ect <= ct) ? 0 : -ENOMEM; |
|---|
| 780 | 780 | } |
|---|
| 781 | 781 | |
|---|