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 X-Spam-Level: X-Spam-Status: No, score=-11.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_CR_TRAILER,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DB34DC4743D for ; Fri, 4 Jun 2021 16:55:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C1FB26140F for ; Fri, 4 Jun 2021 16:55:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229850AbhFDQ5Z (ORCPT ); Fri, 4 Jun 2021 12:57:25 -0400 Received: from mail.kernel.org ([198.145.29.99]:36502 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229791AbhFDQ5Z (ORCPT ); Fri, 4 Jun 2021 12:57:25 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id CFDDB613B4; Fri, 4 Jun 2021 16:55:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1622825738; bh=6TUleeBxMycMAjQItLB0G+hRako0syJLhA3Ykdueq+o=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=vItcd5e5fAS1jUQTvpwu2/XUGxYfRn7D7ize1Mt96yGYY3NLLpr7A9Ei7dUMt6tPw 4/0Nr0D4UFfxsCYrFa5g/cfEcZaTZzlmcnqs8v/bjh3vGw+u3C38vdvQZom8cZ8KoO OoLUX0GKPPUxGAdlRGVvoaDsDQzPUs38A7pbPscawzi8+S/bZ2ErAOkZsvzW8+uUVS 6dez1ZKvI8hIdkQ5kbxv0aqfQ1uskacGf0on9Z/VHMcfVfgiLSC4aPVPI1pbGN0AgD Ojlj1Ul/dP7swLd2oh4P1/r5zZjxcrCpgQwfrbKoXRZVN8iek/IxPbM1w2aOM0pr7d 6tETMUQI1u2Ng== Date: Fri, 4 Jun 2021 09:55:37 -0700 From: Eric Biggers To: Victor Hsieh Cc: linux-fscrypt@vger.kernel.org Subject: Re: [fsverity-utils PATCH 3/4] programs/utils: add full_pwrite() and preallocate_file() Message-ID: References: <20210603195812.50838-1-ebiggers@kernel.org> <20210603195812.50838-4-ebiggers@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-fscrypt@vger.kernel.org On Fri, Jun 04, 2021 at 08:24:50AM -0700, Victor Hsieh wrote: > On Thu, Jun 3, 2021 at 5:58 PM Eric Biggers wrote: > > > > On Thu, Jun 03, 2021 at 05:33:18PM -0700, Victor Hsieh wrote: > > > > + > > > > +bool full_pwrite(struct filedes *file, const void *buf, size_t count, > > > > + u64 offset) > > > > +{ > > > > + while (count) { > > > > + int n = raw_pwrite(file->fd, buf, min(count, INT_MAX), offset); > > > > + > > > > + if (n < 0) { > > > > + error_msg_errno("writing to '%s'", file->name); > > > > + return false; > > > > + } > > > > + buf += n; > > > I think this pointer arithmetic is not portable? Consider changing > > > the type of buf to "const char*". > > > > > > > fsverity-utils is already using void pointer arithmetic elsewhere, for example > > in full_read() and full_write(). > > > > I am allowing the use of some gcc/clang extensions which are widely used, > > including in the Linux kernel (which fsverity-utils is generally trying to > > follow the coding style of), and are annoying to do without. Void pointer > > arithmetic is one of these. > > > > If we really needed to support someone compiling fsverity-utils with e.g. > > Visual Studio, we could add -Wpedantic to the compiler flags and get rid of all > > the gcc/clang extensions. But I don't see a reason to do that now. > > Yeah, that's what I was thinking since the code has #ifdef _WIN32. > I'd think the > "host" side program should be more portable than the kernel itself. > But if this is > already used elsewhere, no objection to keeping assuming so. > > Reviewed-by: Victor Hsieh > Windows builds are supported with Mingw-w64, not with Visual Studio. So that isn't an issue. - Eric