From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DB13DC7EE24 for ; Mon, 5 Jun 2023 15:47:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229511AbjFEPrW (ORCPT ); Mon, 5 Jun 2023 11:47:22 -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-Google-Smtp-Source: ACHHUZ5jznbCgExyaLNQztYMzHdFKbqFXFxr8ajJUyuToLJ3v/+o3EtdG/wbnhNA/zQiIpX8t+oH7Q== 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> 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