Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp5843259rwd; Mon, 5 Jun 2023 09:15:04 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6+4CBRcwoApIPJ5RmRX6GZdCYpYljLUuW4qMyXZZQwjIT/3atICB/kS5507jbsrlSP0nua X-Received: by 2002:a05:6a20:7d8d:b0:100:b715:8ab2 with SMTP id v13-20020a056a207d8d00b00100b7158ab2mr3128805pzj.46.1685981703668; Mon, 05 Jun 2023 09:15:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685981703; cv=none; d=google.com; s=arc-20160816; b=moePJ47sH15IyXp+RnhDvcB0kNeHKL0mPNmyo5WP8KVry8SXjkPgEkQyySBKsuHzqd jv8XY5bwSQ/GkjdONXU+T0ZZ+quly3BlhdAQOxHDaWHDa2xtripzCL20C//nQF7zdAlC eTwouusYhS1Pf9gZkabo0KNiBNTlBC1WSoBsNRl/Kg+tyJ2XjEnOI56eD35sWRkHFYnM ClXjwNQTwP5+Qf8LMZqYgDqV9qcmgbwjdvFReZcTw9M86j9XJ5yh4dXvFN7LyDRtgFIx ZAms1GGmnHxxlS+pwaBGr9yjiJQ4hIDVpivi98h69YodIlTTpX6FKIP1xCziyumVq8fb pBiA== 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=Uqr8cXAKFqCk2YnqjL4KjwaNLI7luK4gqpzwm6zg+eU=; b=Du1jF3Q7Ngf04Popl7R+3CE3eHPRw6PRnA6+lbEHlVgTlS5Br2FDSawt+R3DjSkoBX fuflBEW3znsm5z6iLau4cKbg7MDDkjlwaqeZV3Bxec8Ssgsmm18Y8NvfzQFWiUah5ViB ibzqj1eUFzH3OQ4eb02dnvphLdn6RkcHPY5xqImKQ/659oz9FtoqwBrgZ8VVE5jmI71x +WmBQOpMWJ5DvdyZi5zkMDabpTSqnoABiJWp4+tI3eKy6BOdlz/BA093XjLOZkkCC6K0 qU135xnxoQ6y+3EUpJ/8cuaD3+m09w1IEz48xJvWmk/OinjwykPnnVR0a9Fx5MwyYgnV WNBg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="gAvC/TLk"; 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 p29-20020a637f5d000000b0052c27a0125bsi5811057pgn.738.2023.06.05.09.14.49; Mon, 05 Jun 2023 09:15:03 -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="gAvC/TLk"; 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 S235029AbjFEPrT (ORCPT + 99 others); Mon, 5 Jun 2023 11:47:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49812 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234400AbjFEPrC (ORCPT ); Mon, 5 Jun 2023 11:47:02 -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 931721B8 for ; Mon, 5 Jun 2023 08:45:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1685979840; 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=Uqr8cXAKFqCk2YnqjL4KjwaNLI7luK4gqpzwm6zg+eU=; b=gAvC/TLk+Umfo3ZIbhLEYnb5nYIBosvOgJP5GHus/yelkLjltfx7mKXRghDy7S6wZnEKCU uzyyopM69T8DeAN4Zsb1KJSAUH4illvEvluvYDnihXRr/NLtWWwglZ+L9fF7JrsiqOu4kq Vgd+uWkU5y7dHZW3ppfgES+tOYFr3fs= Received: from mail-qt1-f199.google.com (mail-qt1-f199.google.com [209.85.160.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-357-Ryi_AbQ1Mwq9settJCbrrA-1; Mon, 05 Jun 2023 11:43:59 -0400 X-MC-Unique: Ryi_AbQ1Mwq9settJCbrrA-1 Received: by mail-qt1-f199.google.com with SMTP id d75a77b69052e-3f9aa9aee8cso1362121cf.0 for ; Mon, 05 Jun 2023 08:43:59 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685979838; x=1688571838; 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=Uqr8cXAKFqCk2YnqjL4KjwaNLI7luK4gqpzwm6zg+eU=; b=f2wSv8gGPhmcANvCcpP0fW9V4bb5untmBHy6fPN7ms5i/LzXaikVGdaOkUgLR+mk3W VBT2QotfBT56JNiNn8dlD6z55ed8uZWubNlD0Bmv+DIwB7i85VZYoOKpLdszI0uBLDGM xNKsqlyLsnlB2YO2vh7dedT1IRuAVF3EcbMUY/f99spFrhAWtzID5z1lTQRpaOW3uQxG p1mCxwEqBQFDpJ9UD9IIpLAUeICo9tToEP4SyepUKCNqXhHa6SmKQf1jPjIptQyk0aET TMZJKkNTkYYAra3QcTQeMrYwz2hfv1Ana12JpwIbPvh2hA4D5KSfiwIq90mnj/VN+O1r IKwQ== X-Gm-Message-State: AC+VfDzumZ2S9Eiu3QP72CWXjzaGeK4nc3Ez9BaRjnQnW3z9IngeYVTL 1QSiEah/tJ5V/Em6jejEfg4q1qAKPlX9NsGn2OzRCL0wc68+/eeYmI8ZAiXtCqvxqcJ7Sfx+80d 8f9uRqLwIp79liQanOJiHghPj X-Received: by 2002:ac8:5bcf:0:b0:3f6:b330:4bfb with SMTP id b15-20020ac85bcf000000b003f6b3304bfbmr22480312qtb.0.1685979838649; Mon, 05 Jun 2023 08:43:58 -0700 (PDT) X-Received: by 2002:ac8:5bcf:0:b0:3f6:b330:4bfb with SMTP id b15-20020ac85bcf000000b003f6b3304bfbmr22480298qtb.0.1685979838422; Mon, 05 Jun 2023 08:43:58 -0700 (PDT) Received: from x1n (cpe5c7695f3aee0-cm5c7695f3aede.cpe.net.cable.rogers.com. [99.254.144.39]) by smtp.gmail.com with ESMTPSA id ey5-20020a05622a4c0500b003f6bbd7863csm3196694qtb.86.2023.06.05.08.43.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Jun 2023 08:43:57 -0700 (PDT) Date: Mon, 5 Jun 2023 11:43:56 -0400 From: Peter Xu To: John Hubbard Cc: Andrew Morton , David Hildenbrand , Shuah Khan , Nathan Chancellor , linux-mm@kvack.org, linux-kselftest@vger.kernel.org, LKML Subject: Re: [PATCH v2 03/11] selftests/mm: fix "warning: expression which evaluates to zero..." in mlock2-tests.c Message-ID: References: <20230603021558.95299-1-jhubbard@nvidia.com> <20230603021558.95299-4-jhubbard@nvidia.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20230603021558.95299-4-jhubbard@nvidia.com> X-Spam-Status: No, score=-2.1 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=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 On Fri, Jun 02, 2023 at 07:15:50PM -0700, John Hubbard wrote: > The stop variable is a char*, and the code was assigning a char value to > it. This was generating a warning when compiling with clang. > > However, as both David and Peter pointed out, stop is not even used > after the problematic assignment to a char type. So just delete that > line entirely. > > Cc: David Hildenbrand > Cc: Peter Xu > Signed-off-by: John Hubbard > --- > tools/testing/selftests/mm/mlock2-tests.c | 1 - > 1 file changed, 1 deletion(-) > > diff --git a/tools/testing/selftests/mm/mlock2-tests.c b/tools/testing/selftests/mm/mlock2-tests.c > index 11b2301f3aa3..80cddc0de206 100644 > --- a/tools/testing/selftests/mm/mlock2-tests.c > +++ b/tools/testing/selftests/mm/mlock2-tests.c > @@ -50,7 +50,6 @@ static int get_vm_area(unsigned long addr, struct vm_boundaries *area) > printf("cannot parse /proc/self/maps\n"); > goto out; > } > - stop = '\0'; > > sscanf(line, "%lx", &start); > sscanf(end_addr, "%lx", &end); I'd rather simply make it "*stop = '\0'", or as David suggested dropping stop completely when we're it (assumes that scanf() will always work with number ending with space ' '). No strong opinion here, though. -- Peter Xu