Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp2379505rwd; Fri, 2 Jun 2023 08:37:40 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ62Q88S0SUMDEd+loVvM7A7JEVR6/aELJ8TSMuD1ya5sMkVPjkJBIjg/kAMYPpf8cALnHaT X-Received: by 2002:a17:902:d4c2:b0:1ad:7bc5:b9ea with SMTP id o2-20020a170902d4c200b001ad7bc5b9eamr258171plg.60.1685720260283; Fri, 02 Jun 2023 08:37:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685720260; cv=none; d=google.com; s=arc-20160816; b=GasDsLRpZHMXeL29PcbGLK2Awv5pja7+oUF4XQRyjEkrdSD4Iz+nhOH/PKmOxnBW7+ FDTVhnNfX6qXm1pcwrITR3HahUy6DgeXHwMY6QImtM7WakPbRMrHkuD1nmBi8tDcJEJL 5/QHiY+j+Ji+y4973mFrCwpKNMEVytDU3bJqtQQ54KWYdhmv0cZiyGVgwwD6lCEMKF3k uC1KXSqWZjyrtPF86ShZtWx3FmVS2vMf78ikolXcFy2ezuorrFR3+XOSiiMENpdNGj9a KeQeE2dw/gfqzdnmN1gT4R3MFI+PqbCq53os+K6tEu8m2XU82jOHQkdYD78G8JBThfSU b8pw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=u2PDs4SunVO+2MWPNXOl+T7ECd2Ru9g5P68mrVaPh/w=; b=cMjD/z3/iif3n5kyXwUozLRcDItJAhb5UNa2UVa5JGklww7plJHZIXfTcBnY0Iln1W PVWocWk2tBFS54MEhU6cazgj5jqkTk7n/v/ojdScafxsOF2RlFt/sTK5Kegw7SIGtSop 7KrQSbfTocOw4q5OkLc/lvyFpLyyufhiT+X60Ixuf9HSexcIAOq2BYwnAIS3XV/5GvjZ Yd165OlIFU3jmoXqNOpODhoV3MQMMg268vUid9nwV1OcFZLMXnSQeLhzJCHP2rPBOBHe KrYdS6qRQzBKswaCvVfUnSREol5grLcqg8XXibKbtgVCXt4YLD3EgSkhOsy1slfiTNm0 vlBA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=dLLopFY1; 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=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n5-20020a170902e54500b001a63d8efabasi1072816plf.445.2023.06.02.08.37.28; Fri, 02 Jun 2023 08:37:40 -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; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=dLLopFY1; 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=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236478AbjFBPZn (ORCPT + 99 others); Fri, 2 Jun 2023 11:25:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40790 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234614AbjFBPZl (ORCPT ); Fri, 2 Jun 2023 11:25:41 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DE4FA18D for ; Fri, 2 Jun 2023 08:24:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1685719496; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=u2PDs4SunVO+2MWPNXOl+T7ECd2Ru9g5P68mrVaPh/w=; b=dLLopFY1tDMSofsiNxgZ62Fs5BZgvPhBGO9hMHa7f6AnrSZuEotlcKUKpfBagr5jvcWl5L Y9FCttasmxNUbfXC3tWSx6duSvKYl5DRCer+IfkcFyQK3K6J+ekH8JkGSoJli/UNKGS+J+ +lQcsZDpNkVduwr2UQi/idj/Cn688Js= Received: from mail-qt1-f198.google.com (mail-qt1-f198.google.com [209.85.160.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-501-CK_JPBX4PkyUEQtcxyk9eg-1; Fri, 02 Jun 2023 11:24:55 -0400 X-MC-Unique: CK_JPBX4PkyUEQtcxyk9eg-1 Received: by mail-qt1-f198.google.com with SMTP id d75a77b69052e-3f6b1853e80so2426611cf.1 for ; Fri, 02 Jun 2023 08:24:54 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685719494; x=1688311494; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=u2PDs4SunVO+2MWPNXOl+T7ECd2Ru9g5P68mrVaPh/w=; b=PmX+9osNlFrqMxxEvAeZt4RWNNyyUQNGg5JA3Ns6GL57dVeNu3LFo1gB/ChPP58s8d NGbE4grtp+ZutL9h8yVkX+h44jmSXXb2lJh1qa8z9bWlWBB25AaU/RGX2SHY9dpVW7S+ n0lBbsAo6lT+MmwLji00NC+26HsKB8qOk/rOyWNKtCW/RMlGK48uCmV2L5R+HLRbHqIA BDzfWggrszubgPpEIxIDbgxzb7du77+6+YJN6QvDxErtLluRSkJR/Ot/ELGW7sxhK9nI FkyJ25p3zzSlKU7zlQxj158hK6g2HtsyLFphkCHxtLfbRwQ88tHPDHiqX84DFYARhbYs 5+8Q== X-Gm-Message-State: AC+VfDyB/H+VF7hycLCRdC5RqCCxubXFjilWLHhnNZiugFyoVdu93m5q EJ3dZ29E7yj22fBZrA46LnVkAz+1YflgCD/WmkWv9PR6eSZJ9KNLuGunDJXjH4D0dyoR6zFIsUn FUWtWEHzWw2wmqcKn97JpbZat X-Received: by 2002:a05:622a:1049:b0:3f6:a7ad:9eef with SMTP id f9-20020a05622a104900b003f6a7ad9eefmr13024758qte.1.1685719494560; Fri, 02 Jun 2023 08:24:54 -0700 (PDT) X-Received: by 2002:a05:622a:1049:b0:3f6:a7ad:9eef with SMTP id f9-20020a05622a104900b003f6a7ad9eefmr13024738qte.1.1685719494293; Fri, 02 Jun 2023 08:24:54 -0700 (PDT) Received: from x1n (cpe5c7695f3aee0-cm5c7695f3aede.cpe.net.cable.rogers.com. [99.254.144.39]) by smtp.gmail.com with ESMTPSA id l14-20020ac84cce000000b003e8160cf93asm872496qtv.80.2023.06.02.08.24.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Jun 2023 08:24:53 -0700 (PDT) Date: Fri, 2 Jun 2023 11:24:52 -0400 From: Peter Xu To: David Hildenbrand Cc: John Hubbard , Andrew Morton , Shuah Khan , Nathan Chancellor , linux-mm@kvack.org, linux-kselftest@vger.kernel.org, LKML Subject: Re: [PATCH 04/12] selftests/mm: fix a char* assignment in mlock2-tests.c Message-ID: References: <20230602013358.900637-1-jhubbard@nvidia.com> <20230602013358.900637-5-jhubbard@nvidia.com> <18e69073-1007-07d8-bf0d-5f400ecab8ea@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <18e69073-1007-07d8-bf0d-5f400ecab8ea@redhat.com> X-Spam-Status: No, score=-2.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE 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-kernel@vger.kernel.org On Fri, Jun 02, 2023 at 12:04:57PM +0200, David Hildenbrand wrote: > On 02.06.23 03:33, John Hubbard wrote: > > The stop variable is a char*, so use "\0" when assigning to it, rather > > than attempting to assign a character type. This was generating a > > warning when compiling with clang. > > > > Signed-off-by: John Hubbard > > --- > > tools/testing/selftests/mm/mlock2-tests.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/tools/testing/selftests/mm/mlock2-tests.c b/tools/testing/selftests/mm/mlock2-tests.c > > index 11b2301f3aa3..8ee95077dc25 100644 > > --- a/tools/testing/selftests/mm/mlock2-tests.c > > +++ b/tools/testing/selftests/mm/mlock2-tests.c > > @@ -50,7 +50,7 @@ static int get_vm_area(unsigned long addr, struct vm_boundaries *area) > > printf("cannot parse /proc/self/maps\n"); > > goto out; > > } > > - stop = '\0'; > > + stop = "\0"; > > sscanf(line, "%lx", &start); > > sscanf(end_addr, "%lx", &end); > > > I'm probably missing something, but what is the stop variable supposed to do > here? It's completely unused, no? > > if (!strchr(end_addr, ' ')) { > printf("cannot parse /proc/self/maps\n"); > goto out; > } I guess it wanted to do "*stop = '\0'" but it just didn't matter a lot since the sscanf() just worked.. -- Peter Xu