Received: by 2002:a05:6358:53a8:b0:117:f937:c515 with SMTP id z40csp715992rwe; Fri, 14 Apr 2023 08:49:38 -0700 (PDT) X-Google-Smtp-Source: AKy350a/RgAhKBrMFuQ/meaIYaRgK5gmixTCSnXjJ3SuDQdDlc47aFdcSD/mTC7/ASj2NrbxMe97 X-Received: by 2002:a05:6a00:10c7:b0:638:e474:3a89 with SMTP id d7-20020a056a0010c700b00638e4743a89mr9088047pfu.18.1681487378368; Fri, 14 Apr 2023 08:49:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681487378; cv=none; d=google.com; s=arc-20160816; b=dQSjynvEKDW/05eaozocYrb82DKfb4tEGSkzX5m0bKccpxf1uxAESb2S6SrIxbjdMD IYfjPvvtVVMQHRAwK1HJ+KhTLb7JjolA6uqDcMtjuLZC/5L+4WfXO80loCrcg+LefH2j cY/FAahFEs86CbKmJq2TWhfqWa63MSi2A7qxvvfX4vSgj1cfsZlLlNDaZgPBIDuKw9Wf RnK6ok3hdAn7oHJxCfuZyZ65P8kxQo57gVF1tZfEF2xlziND8OmKApCvlNNekVACHie/ ZPHFElIJdzIGLflw5NfdFh0GQoguWqIRA45xZ3KSiejXXSw9h1Pmc3NyDnx3Goosgkh5 rE2w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=SdeHLcTSYz3bBZMhAQ6oPKTfCX/tSinZf6P6S2VKpeo=; b=GFlLlu8lqUl1NRAdYZML2+Q+06Hur/kUJ51A7DvkSd+Ul+g5rTLgK7gwDieRuWwE26 5aJx1BteEjnXLhSnaVFKTEx4fMsIbIKaq+MH18fbbASOwSAkNT8msXF/eWa6c0xonwxo bhaXQ3YRCKnRzr6n+MjMu4TK+ogpWwWpl/+CaQKmrOXOvx5Y/syC1hvnM4Z13440YM/3 PW/7GmuOZtZM86FQtt/EnFhTPcr/1IEe63vC9AmYkpGhFJaWR+XQHQYQviO3joYYL2qI D0+Wm7Zv9Y4VeL0BrT3waJca6RPrVeXscfG87iA0elH15KFoK+C8Wt5bvsoTmNJSfnr+ +f5Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.org.uk header.s=zeniv-20220401 header.b=Ajmlv2sM; 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=zeniv.linux.org.uk Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c18-20020a056a00009200b00627d5397423si4663040pfj.145.2023.04.14.08.49.24; Fri, 14 Apr 2023 08:49:38 -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.org.uk header.s=zeniv-20220401 header.b=Ajmlv2sM; 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=zeniv.linux.org.uk Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229720AbjDNPql (ORCPT + 99 others); Fri, 14 Apr 2023 11:46:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60490 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230112AbjDNPql (ORCPT ); Fri, 14 Apr 2023 11:46:41 -0400 Received: from zeniv.linux.org.uk (zeniv.linux.org.uk [IPv6:2a03:a000:7:0:5054:ff:fe1c:15ff]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B6410B44E; Fri, 14 Apr 2023 08:46:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=linux.org.uk; s=zeniv-20220401; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=SdeHLcTSYz3bBZMhAQ6oPKTfCX/tSinZf6P6S2VKpeo=; b=Ajmlv2sMHJot/zHME5xc3ImVtu EEbrEFKpapweJn9RKKzPXOpoRCKhgOWqR9KpNE8m6bWO/t8LZYQI5IQiSgrIDw5i+iGa0udoGv8FB 0kIEieEcrmj0dn5+P1DUQrW8TklldItMIpKYVL+1c10FKxLr+pCldFtyxfo/oeByq+eP51CxDAtX7 L0vZ81HjRSs318WEspctN22uQcuKj7D8EwKoqsip/92zBLWKuy9icjM7nLFEjh1hh9TcmyO1klA8O xuq0bdpmKL9sfmmt2tin8sSQKl77M5HQuh5npUAUo3cpuzCPfPOoZmlcCHaE29mwfGAcE1VitXMnD fH09UGXg==; Received: from viro by zeniv.linux.org.uk with local (Exim 4.96 #2 (Red Hat Linux)) id 1pnLd9-0091E4-2H; Fri, 14 Apr 2023 15:46:31 +0000 Date: Fri, 14 Apr 2023 16:46:31 +0100 From: Al Viro To: Luca Vizzarro Cc: linux-kernel@vger.kernel.org, Christian Brauner , Jeff Layton , Chuck Lever , Kevin Brodsky , Vincenzo Frascino , Szabolcs Nagy , Theodore Ts'o , David Laight , Mark Rutland , linux-fsdevel@vger.kernel.org, linux-morello@op-lists.linaro.org Subject: Re: [PATCH v2 1/5] fcntl: Cast commands with int args explicitly Message-ID: <20230414154631.GK3390869@ZenIV> References: <20230414152459.816046-1-Luca.Vizzarro@arm.com> <20230414152459.816046-2-Luca.Vizzarro@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230414152459.816046-2-Luca.Vizzarro@arm.com> Sender: Al Viro X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,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, Apr 14, 2023 at 04:24:55PM +0100, Luca Vizzarro wrote: > void __user *argp = (void __user *)arg; > + int argi = (int)arg; Strictly speaking, conversion from unsigned long to int is an undefined behaviour, unless the value fits into the range representable by int ;-) > case F_SETFD: > err = 0; > - set_close_on_exec(fd, arg & FD_CLOEXEC); > + set_close_on_exec(fd, argi & FD_CLOEXEC); Why? > case F_SETSIG: > /* arg == 0 restores default behaviour. */ > - if (!valid_signal(arg)) { > + if (!valid_signal(argi)) { Why??? > break; > } > err = 0; > - filp->f_owner.signum = arg; > + filp->f_owner.signum = argi; > break; These two are clearly bogus and I'd like to see more details on the series rationale, please.