Message ID | 20230608130157.5871-1-zhangqing@loongson.cn |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:6358:3046:b0:115:7a1d:dabb with SMTP id p6csp324996rwl; Thu, 8 Jun 2023 06:21:32 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4dOaW116jG9zcr4hwsrvlUaS45VSqlWtORWKiXofIeLogeMrB8PfPW3RtZrL6Ss8xkpPMM X-Received: by 2002:a17:903:18c:b0:1b1:4801:f516 with SMTP id z12-20020a170903018c00b001b14801f516mr9567647plg.68.1686230492606; Thu, 08 Jun 2023 06:21:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686230492; cv=none; d=google.com; s=arc-20160816; b=JhpIqkoHafIiZCmtvV2/CkUnk7Ho3Z2RRPMz9DaRfm0URvFraiEHkDvr0bP6SlaI8r pc3xjXneo1HiMd8+PHiKbEfE6m3Vn2I5y1gtHn4PYPq0UWOMtYHXLGnAAr8c006/x3mv dcpyXrMnDShgpF1C7AMBRPgl51hQiKzGsEG/TBQQdHsJtD5kncV1yqwI/qlwkxjl78zn whG+3Kc46oiO0zWmR4437kx1BZd4ENULAq4Nhj8hzL6vlKkq2e15sfGeuxk93EfICeG3 2b48FQMH8vOPeasnGWK9J/EZlivSVvBIN113nCUXsH5lMokvTyfXjp5ronJ15KAoWih1 EgYQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=6STdIYIIuQx+6T5qRRYdaHnjiVGjEHQvvupV59YgUac=; b=WOk8ykw02v3Qv1qwbOGqp8qOOx4cdJ7wKAnyvtDj1XpydEmUBYgPlPdIqbPubO9vXN rkfON4HJkEwnt3eYtfmzq8GVkoskbEtE00FU/FqqZwkFLfpanUUCPD/3ZSRmioE4so6e xt6Hrl4ZtAcfeC0k/S4kvbN32hgK+G2e0zACZw7pe5w4Ycva6YLJWmiAwZLx2J6Ns8q0 wSEr2Z9Dij+YEN1yq2hYN/JnYSCKcKAgkZw/i7a50eb4U17JfjY2IhXo1BezIxlIqKtK baPqevD0oNGmQdtmGS7E0r342LwIn6a+Q3Db2J0HAal+csTcoyXb5lwXVtNCZ1i0mXBJ VzDw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w6-20020a170902e88600b001b02390367fsi1072532plg.595.2023.06.08.06.21.15; Thu, 08 Jun 2023 06:21:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236129AbjFHNCT (ORCPT <rfc822;literming00@gmail.com> + 99 others); Thu, 8 Jun 2023 09:02:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41708 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236617AbjFHNCK (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 8 Jun 2023 09:02:10 -0400 Received: from mail.loongson.cn (mail.loongson.cn [114.242.206.163]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 516B41712 for <linux-kernel@vger.kernel.org>; Thu, 8 Jun 2023 06:02:07 -0700 (PDT) Received: from loongson.cn (unknown [113.200.148.30]) by gateway (Coremail) with SMTP id _____8DxyOlN0YFkGIkAAA--.1882S3; Thu, 08 Jun 2023 21:02:06 +0800 (CST) Received: from localhost.localdomain (unknown [113.200.148.30]) by localhost.localdomain (Coremail) with SMTP id AQAAf8DxFORM0YFkN6MHAA--.24107S2; Thu, 08 Jun 2023 21:02:05 +0800 (CST) From: Qing Zhang <zhangqing@loongson.cn> To: Huacai Chen <chenhuacai@kernel.org>, WANG Xuerui <kernel@xen0n.name> Cc: loongarch@lists.linux.dev, linux-kernel@vger.kernel.org, Colin King <colin.i.king@gmail.com> Subject: [PATCH] LoongArch: Avoid uninitialized alignment_mask Date: Thu, 8 Jun 2023 21:01:57 +0800 Message-Id: <20230608130157.5871-1-zhangqing@loongson.cn> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID: AQAAf8DxFORM0YFkN6MHAA--.24107S2 X-CM-SenderInfo: x2kd0wptlqwqxorr0wxvrqhubq/ X-Coremail-Antispam: 1Uk129KBj9xXoWrZFyUAr1UJw47Xr4xZw4rtFc_yoWfXrc_Za 47Jw4DWr48JF10vasFv343WF90v3WrtFnYkF92gr9rX3WrCa45JrWxJ3W5ZrykKFWI9rZx J395u3s0yr1jyosvyTuYvTs0mTUanT9S1TB71UUUUjUqnTZGkaVYY2UrUUUUj1kv1TuYvT s0mT0YCTnIWjqI5I8CrVACY4xI64kE6c02F40Ex7xfYxn0WfASr-VFAUDa7-sFnT9fnUUI cSsGvfJTRUUUb3xYFVCjjxCrM7AC8VAFwI0_Jr0_Gr1l1xkIjI8I6I8E6xAIw20EY4v20x vaj40_Wr0E3s1l1IIY67AEw4v_Jr0_Jr4l8cAvFVAK0II2c7xJM28CjxkF64kEwVA0rcxS w2x7M28EF7xvwVC0I7IYx2IY67AKxVWUCVW8JwA2z4x0Y4vE2Ix0cI8IcVCY1x0267AKxV WUJVW8JwA2z4x0Y4vEx4A2jsIE14v26r4UJVWxJr1l84ACjcxK6I8E87Iv6xkF7I0E14v2 6F4UJVW0owAaw2AFwI0_Jrv_JF1le2I262IYc4CY6c8Ij28IcVAaY2xG8wAqjxCEc2xF0c Ia020Ex4CE44I27wAqx4xG64xvF2IEw4CE5I8CrVC2j2WlYx0E2Ix0cI8IcVAFwI0_JF0_ Jw1lYx0Ex4A2jsIE14v26r4j6F4UMcvjeVCFs4IE7xkEbVWUJVW8JwACjcxG0xvY0x0EwI xGrwCF04k20xvY0x0EwIxGrwCFx2IqxVCFs4IE7xkEbVWUJVW8JwCFI7km07C267AKxVWU XVWUAwC20s026c02F40E14v26r1j6r18MI8I3I0E7480Y4vE14v26r106r1rMI8E67AF67 kF1VAFwI0_JF0_Jw1lIxkGc2Ij64vIr41lIxAIcVC0I7IYx2IY67AKxVWUJVWUCwCI42IY 6xIIjxv20xvEc7CjxVAFwI0_Jr0_Gr1lIxAIcVCF04k26cxKx2IYs7xG6r1j6r1xMIIF0x vEx4A2jsIE14v26r1j6r4UMIIF0xvEx4A2jsIEc7CjxVAFwI0_Jr0_GrUvcSsGvfC2Kfnx nUUI43ZEXa7IU8SAp5UUUUU== X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1768140824759111085?= X-GMAIL-MSGID: =?utf-8?q?1768140824759111085?= |
Series |
LoongArch: Avoid uninitialized alignment_mask
|
|
Commit Message
Qing Zhang
June 8, 2023, 1:01 p.m. UTC
The hardware monitoring points for instruction fetching and
load/store operations need to align 4 bytes or 1/2/4/8 bytes respectively.
Reported-by: Colin King <colin.i.king@gmail.com>
Signed-off-by: Qing Zhang <zhangqing@loongson.cn>
---
arch/loongarch/kernel/hw_breakpoint.c | 2 ++
1 file changed, 2 insertions(+)
Comments
Queued, thanks. Huacai On Thu, Jun 8, 2023 at 9:02 PM Qing Zhang <zhangqing@loongson.cn> wrote: > > The hardware monitoring points for instruction fetching and > load/store operations need to align 4 bytes or 1/2/4/8 bytes respectively. > > Reported-by: Colin King <colin.i.king@gmail.com> > Signed-off-by: Qing Zhang <zhangqing@loongson.cn> > --- > arch/loongarch/kernel/hw_breakpoint.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/arch/loongarch/kernel/hw_breakpoint.c b/arch/loongarch/kernel/hw_breakpoint.c > index 2406c95b34cc..021b59c248fa 100644 > --- a/arch/loongarch/kernel/hw_breakpoint.c > +++ b/arch/loongarch/kernel/hw_breakpoint.c > @@ -396,6 +396,8 @@ int hw_breakpoint_arch_parse(struct perf_event *bp, > > if (hw->ctrl.type != LOONGARCH_BREAKPOINT_EXECUTE) > alignment_mask = 0x7; > + else > + alignment_mask = 0x3; > offset = hw->address & alignment_mask; > > hw->address &= ~alignment_mask; > -- > 2.20.1 > >
diff --git a/arch/loongarch/kernel/hw_breakpoint.c b/arch/loongarch/kernel/hw_breakpoint.c index 2406c95b34cc..021b59c248fa 100644 --- a/arch/loongarch/kernel/hw_breakpoint.c +++ b/arch/loongarch/kernel/hw_breakpoint.c @@ -396,6 +396,8 @@ int hw_breakpoint_arch_parse(struct perf_event *bp, if (hw->ctrl.type != LOONGARCH_BREAKPOINT_EXECUTE) alignment_mask = 0x7; + else + alignment_mask = 0x3; offset = hw->address & alignment_mask; hw->address &= ~alignment_mask;