Received: by 2002:a05:6358:5282:b0:b5:90e7:25cb with SMTP id g2csp3180495rwa; Mon, 22 Aug 2022 23:34:58 -0700 (PDT) X-Google-Smtp-Source: AA6agR7xIqsFBpWN8W1ZchosTixbpHEGpUZwhK5VhFKOBBE0LthF36c52jf+rYVMuv6iH+Dts5Tf X-Received: by 2002:a17:90b:38c8:b0:1fa:c125:bd9b with SMTP id nn8-20020a17090b38c800b001fac125bd9bmr1883147pjb.219.1661236498665; Mon, 22 Aug 2022 23:34:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661236498; cv=none; d=google.com; s=arc-20160816; b=SmBH81h+6869B/gl88GlIS/UYrdhXMH4DpmnBEuh4dWoCd5gL0WNbhBlhpSrBZr9ef CTF8thbmTxqmYdqv1215qJNlNO3k2p1qktcUQUfHdR8FLqFo0x/OT5FRJMpQ0HNwsRUj pR3M7H21THTKC5DyOFzu9zl/hm+rCX71HSUsIQenIdhL9z6GifzeSSMe7boA4frIxWfo 9emdeNX4FS2FFMVbxKNkgyqnIPiLVpLgY4O6ziVG9uPrC+UI3+qzJ/Jf3oQj3KNAGkXk 6S95QfaygravXV2rcVGzwWx71xU2ahTzNJXN0DJI/ChC3GcRw10KI4GCVr7wmGPzQFIy pcpA== 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=pkY6/lp8j7R/zACHbd9WQHR7mqNOpJDBaYhA1YfGh1I=; b=HilA6Tc6hUxsByFoFDrokgABv06xMcpfkDLyJ5NXtXCHasI/01SsCpAo9u/+e0T3jq MjPWc3s7zcDI31qfXi6numEIwkR8Nzex40zjQdafVzflt8CvBM5J4iRhVlhYn8KQ7cHo G+g8Pmo29N558NyGfjbv2+Vi95jxYUHKx3yCJ+rZ5fzE7oaWkqjfIc55+vmYWtiR0CzP K7qRaeaRqN6wGS/7F72IgerDFaEFg/mqf7oJCciaXiHEUCEur42u/7x2DiwGy4VIsqiF X/VnBnJFb31uzv2MFRK+dtR+TjCOcVsd14IAdSq+3LTkvu9n9Q4clRpowlTLUJp+dwXh +9lA== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e30-20020a63745e000000b0041b6032a154si14491843pgn.574.2022.08.22.23.34.46; Mon, 22 Aug 2022 23:34:58 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237040AbiHWFwf (ORCPT + 99 others); Tue, 23 Aug 2022 01:52:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50846 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240300AbiHWFwF (ORCPT ); Tue, 23 Aug 2022 01:52:05 -0400 Received: from out30-44.freemail.mail.aliyun.com (out30-44.freemail.mail.aliyun.com [115.124.30.44]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9EC105F12B for ; Mon, 22 Aug 2022 22:52:02 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R151e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018045176;MF=jiapeng.chong@linux.alibaba.com;NM=1;PH=DS;RN=10;SR=0;TI=SMTPD_---0VN0H0NZ_1661233903; Received: from localhost(mailfrom:jiapeng.chong@linux.alibaba.com fp:SMTPD_---0VN0H0NZ_1661233903) by smtp.aliyun-inc.com; Tue, 23 Aug 2022 13:51:59 +0800 From: Jiapeng Chong To: jpoimboe@kernel.org Cc: peterz@infradead.org, tglx@linutronix.de, mingo@redhat.com, dave.hansen@linux.intel.com, x86@kernel.org, hpa@zytor.com, linux-kernel@vger.kernel.org, Jiapeng Chong , Abaci Robot Subject: [PATCH] x86/unwind/orc: Use swap() instead of open coding it Date: Tue, 23 Aug 2022 13:51:41 +0800 Message-Id: <20220823055141.18380-1-jiapeng.chong@linux.alibaba.com> X-Mailer: git-send-email 2.20.1.7.g153144c MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-9.9 required=5.0 tests=BAYES_00, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,UNPARSEABLE_RELAY,USER_IN_DEF_SPF_WL 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: X-Mailing-List: linux-kernel@vger.kernel.org ./arch/x86/kernel/unwind_orc.c:217:16-17: WARNING opportunity for swap(). https://bugzilla.openanolis.cn/show_bug.cgi?id=1943 Reported-by: Abaci Robot Signed-off-by: Jiapeng Chong --- arch/x86/kernel/unwind_orc.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/arch/x86/kernel/unwind_orc.c b/arch/x86/kernel/unwind_orc.c index 0ea57da92940..4569959581b1 100644 --- a/arch/x86/kernel/unwind_orc.c +++ b/arch/x86/kernel/unwind_orc.c @@ -201,7 +201,6 @@ static struct orc_entry *cur_orc_table = __start_orc_unwind; static void orc_sort_swap(void *_a, void *_b, int size) { struct orc_entry *orc_a, *orc_b; - struct orc_entry orc_tmp; int *a = _a, *b = _b, tmp; int delta = _b - _a; @@ -213,9 +212,7 @@ static void orc_sort_swap(void *_a, void *_b, int size) /* Swap the corresponding .orc_unwind entries: */ orc_a = cur_orc_table + (a - cur_orc_ip_table); orc_b = cur_orc_table + (b - cur_orc_ip_table); - orc_tmp = *orc_a; - *orc_a = *orc_b; - *orc_b = orc_tmp; + swap(*orc_a, *orc_b); } static int orc_sort_cmp(const void *_a, const void *_b) -- 2.20.1.7.g153144c