From patchwork Thu Jan 7 22:52:27 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Fainelli X-Patchwork-Id: 358839 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.5 required=3.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_INVALID, DKIM_SIGNED, FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_RED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 13278C43332 for ; Thu, 7 Jan 2021 22:53:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id EC56323715 for ; Thu, 7 Jan 2021 22:53:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728991AbhAGWx2 (ORCPT ); Thu, 7 Jan 2021 17:53:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50774 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728575AbhAGWxX (ORCPT ); Thu, 7 Jan 2021 17:53:23 -0500 Received: from mail-pg1-x52e.google.com (mail-pg1-x52e.google.com [IPv6:2607:f8b0:4864:20::52e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ACE84C0612F6; Thu, 7 Jan 2021 14:52:43 -0800 (PST) Received: by mail-pg1-x52e.google.com with SMTP id i5so6348378pgo.1; Thu, 07 Jan 2021 14:52:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=kkJanOIEtiwTHNCIrofj7wjT/1euAC35OtiXO+rsH/E=; b=Ei2AWvifiZYCkJWJPT/YrvJ7SPQ9DmXUkyPZsf10UwBdcdXPyoVE+NPHlQnK0ul/mr mxAHqS+kkDqHCoGfNUFSq3INr5TOGHI9tvhJicP8nW7HAi3FrW+z7nztuk29wuVmqWCv 1SUKMpcR/n8twiVwFTrjNsQIt8ij8PT/hXw1R7xqJU81hh9EfYUuGHuMW0B2ZXLTSUiF th2JbqpTak31kP4FM/VH1UIAesWvXdIkdRs8sXkQ3sYQZmaZMqCK1LNOIAQXLaw9TSNM XpjhlId5Sc6sUwtK3cX5PCxppMZF6umoPpnltEEhdpPaZWZJrv543rm2eZvXKPRUlrjZ daWA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=kkJanOIEtiwTHNCIrofj7wjT/1euAC35OtiXO+rsH/E=; b=HkzkJXRWdBRZ3ZaDKU7UV3u4TW6QqzAcDY5xFUxuGYeprPQBWQbdJ9ip+nXRTL0wHA UAx9gKXkakq+tbduQon8Xpw71+8U6HZi6euEicWj+sPK22OW7X5C199yZmIBTCI+RloV YUV7M6d4N8UhgFzUDda7NwcbA36wJgb2HeqOoULUEzg82RrYngsdCEhH+DCZr2FJquPA Ti4/+CA9BS+2gp5l8dCMul46akoVXcyr8t/jYBW0GRXk/c1wHYDacPzvfRms+AU8H/ij MJsZYm1A3rhg8dJuJiVM4XtunhTgHlzZ1gF9u1aIvZBLeh4CGLlbNIojK+AOM/j3etDh 2chg== X-Gm-Message-State: AOAM532FzSdiUaqbpZaUngOCKrMDCjkIiCMI/52UFKFpoJXXEg0Ylb/u 8RZhgcoHouVFJRsNYDxSK+J9KCR7jPo= X-Google-Smtp-Source: ABdhPJyLusqCid8FHWWE34bs/i16qmL4MuvouQT7oKVY/d5gsIShKLLYlnuuo4YbpUicFqtpGLf9PA== X-Received: by 2002:aa7:9625:0:b029:1a4:3b48:a19c with SMTP id r5-20020aa796250000b02901a43b48a19cmr4089524pfg.13.1610059962868; Thu, 07 Jan 2021 14:52:42 -0800 (PST) Received: from fainelli-desktop.igp.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id a10sm6510603pfi.168.2021.01.07.14.52.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Jan 2021 14:52:42 -0800 (PST) From: Florian Fainelli To: stable@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Leonard Crestez , Jan Kiszka , Jason Wessel , Kieran Bingham , Andrew Morton , Linus Torvalds , Florian Fainelli , Kieran Bingham , =?utf-8?q?Andr=C3=A9_Draszik?= , Du Changbin Subject: [stable 4.9.y 2/4] scripts/gdb: lx-dmesg: cast log_buf to void* for addr fetch Date: Thu, 7 Jan 2021 14:52:27 -0800 Message-Id: <20210107225229.1502459-3-f.fainelli@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210107225229.1502459-1-f.fainelli@gmail.com> References: <20210107225229.1502459-1-f.fainelli@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Leonard Crestez commit c454756f47277b651ad41a5a163499294529e35d upstream In some cases it is possible for the str() conversion here to throw encoding errors because log_buf might not point to valid ascii. For example: (gdb) python print str(gdb.parse_and_eval("log_buf")) Traceback (most recent call last): File "", line 1, in UnicodeEncodeError: 'ascii' codec can't encode character u'\u0303' in position 24: ordinal not in range(128) Avoid this by explicitly casting to (void *) inside the gdb expression. Link: http://lkml.kernel.org/r/ba6f85dbb02ca980ebd0e2399b0649423399b565.1498481469.git.leonard.crestez@nxp.com Signed-off-by: Leonard Crestez Reviewed-by: Jan Kiszka Cc: Jason Wessel Cc: Kieran Bingham Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds Signed-off-by: Florian Fainelli --- scripts/gdb/linux/dmesg.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/gdb/linux/dmesg.py b/scripts/gdb/linux/dmesg.py index 5afd1098e33a..f5a030333dfd 100644 --- a/scripts/gdb/linux/dmesg.py +++ b/scripts/gdb/linux/dmesg.py @@ -24,7 +24,7 @@ class LxDmesg(gdb.Command): def invoke(self, arg, from_tty): log_buf_addr = int(str(gdb.parse_and_eval( - "'printk.c'::log_buf")).split()[0], 16) + "(void *)'printk.c'::log_buf")).split()[0], 16) log_first_idx = int(gdb.parse_and_eval("'printk.c'::log_first_idx")) log_next_idx = int(gdb.parse_and_eval("'printk.c'::log_next_idx")) log_buf_len = int(gdb.parse_and_eval("'printk.c'::log_buf_len"))