From 44ce6969048c2e252f3f9d66fa485c77bdab8ae7 Mon Sep 17 00:00:00 2001 From: YOUR_NAME Date: Tue, 8 Jun 2021 20:01:39 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=86=85=E6=A0=B8=E6=80=81=E5=9C=A8cons?= =?UTF-8?q?ole=E5=88=9D=E5=A7=8B=E5=8C=96=E5=AE=8C=E6=88=90=E5=90=8E?= =?UTF-8?q?=EF=BC=8C=E4=BD=BF=E7=94=A8printf=E6=97=A0=E6=B3=95=E6=AD=A3?= =?UTF-8?q?=E5=B8=B8=E6=89=93=E5=8D=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit printf实现流程上会调用cmd为TIOCGWINSZ的ioctl命令,该命令的实现 在console层ConsoleGetWinSize函数中,而此函数copy结果时使用函数 LOS_ArchCopyToUser,由于该过程在内核态,导致LOS_ArchCopyToUser失败, 从而引发printf无法正常打印的问题。 close: #I3UG00 Signed-off-by: zhangfanfan Change-Id: I3e85f682429cbe30842206842ddb2a8388ec8412 --- kernel/common/console.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/kernel/common/console.c b/kernel/common/console.c index 96996012..8c916a1a 100644 --- a/kernel/common/console.c +++ b/kernel/common/console.c @@ -853,11 +853,10 @@ STATIC INT32 ConsoleGetWinSize(unsigned long arg) .ws_row = DEFAULT_WINDOW_SIZE_ROW }; - if(LOS_ArchCopyToUser((VOID *)arg, &kws, sizeof(struct winsize)) != 0) { + if (LOS_CopyFromKernel((VOID *)arg, sizeof(struct winsize), &kws, sizeof(struct winsize)) != 0) { return -EFAULT; - } else { - return LOS_OK; } + return LOS_OK; } STATIC INT32 ConsoleGetTermios(unsigned long arg)