Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp3082560rwb; Mon, 19 Sep 2022 14:51:20 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4VtjYxU0aldoEB5ty1d3CH/FM95ePZYluuvVH1N/SOAIIrcsSDockX9bmnrmQy/yzd06iI X-Received: by 2002:a17:907:1614:b0:780:633d:c7a1 with SMTP id hb20-20020a170907161400b00780633dc7a1mr15069257ejc.708.1663624279843; Mon, 19 Sep 2022 14:51:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663624279; cv=none; d=google.com; s=arc-20160816; b=QijVQURMy0o+J+ZIUZPmTsGyQ5aI+7UYs1xuQUrRd8YFAjs9MGerP998WOHAk0flvX sMtX/cJ4PvEwSr26EXtohvf0kNUIvC7y5j/yeTNwCHAkJotmL7KzJhHD0HdFabli82ca /PmrHna65lpj0ufz0HLwRG3blB19ocwtyn2lQKWupc+CMpSAj2z5zBUNn+OT/GjKx3je iIpLSyCIiTE6WfRj5YkoZ9opytSbJdAN7HZuh8u0aB/vUQSsiD6HKv0hmvB+mPD97YbS u8q+IFsxzp+U6nsZh84sylpIredBPEz5+ZStyIoboLpcfYoEhFOwiD5wUFO4jHxUenab fZUA== 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 :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=LLlk0p4jaHsCxpLnH8Z0mY/ce+G9PQJVP6YvWJBKp6A=; b=tLw5GzQ0iySZsMgMlleJXuwSYHDnI0UgNXE8G2/2OdR+uVM5bwJua1D7SgIGbz7PKw f/g/3iYU5S2+keriNrf2PAjukQbOV4XwS+8wlOihjeqhWNXiyoqt2UskWGoePgWLDD1V 23EfUSlWEiPeupqMi+1i9vGPQJhfrs+sCQhBxIb33PwAziCWgaxf54dklysIWZ9DIBFy qTDFb0wi+bYvziMTAlmh1gTdl8gO8eahG6dq7bswy/dJ5H8BeBNwSaKGmjFUWxJJKiAB m15NqpET81i4RH5VAwiZiMIHGOyL/Yl57NMYaEV0PZXbjeX1opPDauAssZPP6sWbu8nN Fn+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=korg header.b=ciCRVrcS; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id sa42-20020a1709076d2a00b0077c2e5ea05dsi21799850ejc.267.2022.09.19.14.50.53; Mon, 19 Sep 2022 14:51:19 -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=@linux-foundation.org header.s=korg header.b=ciCRVrcS; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229750AbiISVYj (ORCPT + 99 others); Mon, 19 Sep 2022 17:24:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34500 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229647AbiISVYg (ORCPT ); Mon, 19 Sep 2022 17:24:36 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6679EF0D; Mon, 19 Sep 2022 14:24:32 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id BE49B61EBF; Mon, 19 Sep 2022 21:24:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7FC1EC433D6; Mon, 19 Sep 2022 21:24:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1663622671; bh=1cpRM5tko1UyvK/nVYxUegMJmu9VP3/Cg/QFSqlvimo=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=ciCRVrcSeMfuR6qISsRAC4H1iyJ3Y4cq4cQNWZ9Ru2HqJZTRLKOYDcB811D7qI5ld CsKPWr03/vXKCFGxR3K0KpxTHvj8zlAgz4u+o5vvJzPtiJBwOkPV4jjh0VFU8DXtVt JgLvfjVc/FDrDoIOyvmN13J9Zw9NxsCAofv0KvIU= Date: Mon, 19 Sep 2022 14:24:13 -0700 From: Andrew Morton To: Eliav Farber Cc: , , , , , , , Akinobu Mita Subject: Re: [PATCH] libfs: fix negative value support in simple_attr_write() Message-Id: <20220919142413.c294de0777dcac8abe2d2f71@linux-foundation.org> In-Reply-To: <20220918135036.33595-1-farbere@amazon.com> References: <20220918135036.33595-1-farbere@amazon.com> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.33; x86_64-redhat-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-8.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS 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 Sun, 18 Sep 2022 13:50:36 +0000 Eliav Farber wrote: > After commit 488dac0c9237 ("libfs: fix error cast of negative value in > simple_attr_write()"), a user trying set a negative value will get a > '-EINVAL' error, because simple_attr_write() was modified to use > kstrtoull() which can handle only unsigned values, instead of > simple_strtoll(). > > This breaks all the places using DEFINE_DEBUGFS_ATTRIBUTE() with format > of a signed integer. > > The u64 value which attr->set() receives is not an issue for negative > numbers. > The %lld and %llu in any case are for 64-bit value. Representing it as > unsigned simplifies the generic code, but it doesn't mean we can't keep > their signed value if we know that. > > This change basically reverts the mentioned commit, but uses kstrtoll() > instead of simple_strtoll() which is obsolete. > https://lkml.kernel.org/r/20220919172418.45257-1-akinobu.mita@gmail.com addresses the same thing. Should the final version of this fix be backported into -stable trees?