From patchwork Thu Mar 23 12:37:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 1760308 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=ozlabs.org (client-ip=150.107.74.76; helo=gandalf.ozlabs.org; envelope-from=srs0=enmh=7p=vger.kernel.org=linux-ext4-owner@ozlabs.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=DVpEUyVc; dkim-atps=neutral Received: from gandalf.ozlabs.org (gandalf.ozlabs.org [150.107.74.76]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Pj4bF6JH4z1yXy for ; Thu, 23 Mar 2023 23:36:41 +1100 (AEDT) Received: from gandalf.ozlabs.org (gandalf.ozlabs.org [150.107.74.76]) by gandalf.ozlabs.org (Postfix) with ESMTP id 4Pj4bD600Yz4x5Q for ; Thu, 23 Mar 2023 23:36:40 +1100 (AEDT) Received: by gandalf.ozlabs.org (Postfix) id 4Pj4bD5xgWz4x80; Thu, 23 Mar 2023 23:36:40 +1100 (AEDT) Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: gandalf.ozlabs.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: gandalf.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=2620:137:e000::1:20; helo=out1.vger.email; envelope-from=linux-ext4-owner@vger.kernel.org; receiver=) Authentication-Results: gandalf.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=DVpEUyVc; dkim-atps=neutral Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by gandalf.ozlabs.org (Postfix) with ESMTP id 4Pj4bD1jrHz4x5Q for ; Thu, 23 Mar 2023 23:36:40 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231788AbjCWMgj (ORCPT ); Thu, 23 Mar 2023 08:36:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38058 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231758AbjCWMgi (ORCPT ); Thu, 23 Mar 2023 08:36:38 -0400 Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 13B071B56F; Thu, 23 Mar 2023 05:36:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1679574984; x=1711110984; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Uqba7KW+LSTrR6KDuN+F/tgiTmPx6AhRcJexGJYfzL0=; b=DVpEUyVcB9cuHQaevin9Hs+FrKfkjYEBilsuB7NZEcmJ68Q6q5r1gG31 aoUldmS7ijsb/RnEvdcQ/AGw8VWqYvT6mbmJ6cLoVQsk4OO66IizRsR+9 fn8AHZvaZmXMiEgWNtxCHFpi7wc7WMocpWf/Xj/0JxGQnz565QA0Mnj+P zrHZePsVE6HiBlKFLldJVcYA02CXlD85JCEo5fBX1YHKugzTDpCtEztlt 4Dlx6rJ5qYBKowjEn0nlMqB6bOFEQbUtxhFd/TaiD7InqMnD1Z5Gy7Vof +QYZaieWqldzU0n3Z5ZzMpOa9gz1waTZ3elG1kpxSQOv/AjfNMM09BSk6 Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10657"; a="404359764" X-IronPort-AV: E=Sophos;i="5.98,283,1673942400"; d="scan'208";a="404359764" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Mar 2023 05:36:23 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10657"; a="675681050" X-IronPort-AV: E=Sophos;i="5.98,283,1673942400"; d="scan'208";a="675681050" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga007.jf.intel.com with ESMTP; 23 Mar 2023 05:36:20 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 3AE4C176; Thu, 23 Mar 2023 14:37:07 +0200 (EET) From: Andy Shevchenko To: Kees Cook , Greg Kroah-Hartman , Andy Shevchenko , Cezary Rojewski , linux-ext4@vger.kernel.org, linux-kernel@vger.kernel.org Cc: "Theodore Ts'o" , Jan Kara , Andy Shevchenko , "Rafael J. Wysocki" Subject: [PATCH v2 3/3] kobject: Use return value of strreplace() Date: Thu, 23 Mar 2023 14:37:04 +0200 Message-Id: <20230323123704.37983-4-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.40.0.1.gaa8946217a0b In-Reply-To: <20230323123704.37983-1-andriy.shevchenko@linux.intel.com> References: <20230323123704.37983-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.4 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,RCVD_IN_MSPIKE_H2, SPF_HELO_NONE,SPF_NONE autolearn=unavailable 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-ext4@vger.kernel.org Since strreplace() returns the pointer to the string itself, we may use it directly in the code. Signed-off-by: Andy Shevchenko --- lib/kobject.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/kobject.c b/lib/kobject.c index f79a434e1231..16d530f9c174 100644 --- a/lib/kobject.c +++ b/lib/kobject.c @@ -281,8 +281,7 @@ int kobject_set_name_vargs(struct kobject *kobj, const char *fmt, kfree_const(s); if (!t) return -ENOMEM; - strreplace(t, '/', '!'); - s = t; + s = strreplace(t, '/', '!'); } kfree_const(kobj->name); kobj->name = s;