forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-02-19 1c055e55a242a33e574e48be530e06770a210dcd
kernel/drivers/tty/vt/consolemap.c
....@@ -12,7 +12,7 @@
1212 * Fix bug in inverse translation. Stanislav Voronyi <stas@cnti.uanet.kharkov.ua>, Dec 1998
1313 *
1414 * 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
1616 *
1717 * We cannot allow page fault to happen while holding the console_lock.
1818 * Therefore, all the userspace copy operations have to be done outside
....@@ -268,7 +268,7 @@
268268 * was active.
269269 * Still, it is now possible to a certain extent to cut and paste non-ASCII.
270270 */
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)
272272 {
273273 struct uni_pagedir *p;
274274 int m;
....@@ -542,7 +542,7 @@
542542 if (!ct)
543543 return 0;
544544
545
- unilist = memdup_user(list, ct * sizeof(struct unipair));
545
+ unilist = vmemdup_user(list, array_size(sizeof(struct unipair), ct));
546546 if (IS_ERR(unilist))
547547 return PTR_ERR(unilist);
548548
....@@ -641,7 +641,7 @@
641641
642642 out_unlock:
643643 console_unlock();
644
- kfree(unilist);
644
+ kvfree(unilist);
645645 return err;
646646 }
647647
....@@ -708,7 +708,7 @@
708708 /**
709709 * con_copy_unimap - copy unimap between two vts
710710 * @dst_vc: target
711
- * @src_vt: source
711
+ * @src_vc: source
712712 *
713713 * The caller must hold the console lock when invoking this method
714714 */
....@@ -743,7 +743,7 @@
743743 struct uni_pagedir *p;
744744 struct unipair *unilist;
745745
746
- unilist = kmalloc_array(ct, sizeof(struct unipair), GFP_KERNEL);
746
+ unilist = kvmalloc_array(ct, sizeof(struct unipair), GFP_KERNEL);
747747 if (!unilist)
748748 return -ENOMEM;
749749
....@@ -775,7 +775,7 @@
775775 if (copy_to_user(list, unilist, min(ect, ct) * sizeof(struct unipair)))
776776 ret = -EFAULT;
777777 put_user(ect, uct);
778
- kfree(unilist);
778
+ kvfree(unilist);
779779 return ret ? ret : (ect <= ct) ? 0 : -ENOMEM;
780780 }
781781