From owner-svn-src-projects@freebsd.org Sun May 26 14:02:56 2019 Return-Path: Delivered-To: svn-src-projects@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AFBCB15A731F for ; Sun, 26 May 2019 14:02:56 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: from mail-pf1-x435.google.com (mail-pf1-x435.google.com [IPv6:2607:f8b0:4864:20::435]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1E7BF8860E; Sun, 26 May 2019 14:02:56 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: by mail-pf1-x435.google.com with SMTP id c6so8019228pfa.10; Sun, 26 May 2019 07:02:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=XmHr3muuUY+kGCgH/kzIyjG+Fewv3eycxy42LwcBHfo=; b=RlJXIn9Fyed/RVOpJvvliyQsQSR194yMPG8HzAVTDIdMwlQvQN+pE+2H0ajzNwsEq6 DvtRHKP7iLDLidTAZg3WO1DxVLyFvwZ/XzN1IW693Kf6fsznpQcc0N/TowjRuaSWMFix tqFWNjwcxUUDFtyBtDZ97ZHpCJWXVbfo4WGyx8WEDJZ4fQGcmSCvt0XK8bbxFoPMvTxM M96Hej9TZykEgN/RwMVPolnq5XDeBeT+M6CbpCWl37dgRHgNv8vfPQV5nMVeNJerbxpV Gn5mVz/adL15FfS1lwk3ekPSj464nRxxq3lNCVAMRmgOm9LI58k5EjHpqzD3g5SBOjh6 evJQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=XmHr3muuUY+kGCgH/kzIyjG+Fewv3eycxy42LwcBHfo=; b=bhq6X9Ar0pBqwWZr2S7RRPeAbS1EubpEQody0+CqF60rJoTD+KABVeXSbXGGLXMk+j AZkFAudxEShf71V+/yGXV84vIwfQYebDuotujiQp1gpgQvaSux5CeAgKFGoqVuht8SQC vz58PmQBeqf4dbnQRYzuxxoPZWq0smrAbHUsfM0q1WsewPePRcHEXzFMEUxavFQW6iLd mqfLxYABap/UApnQD9ekVjbl6uPzJtvMyBbVUssRch/x7tcRwpUc5qyZet/mnnI+g1KT 5PvR11uxqOkwHjUOpZbrbg6e8mwN9/qxkGcYaKnj4HXyxUNdZ3vRa85pdniL399xUsdW 0v8A== X-Gm-Message-State: APjAAAUSjS52Ksqag8cEUeeVG0LsuH/vVWM0/Fn86mxGnnZ62mTkIs1u xd1CG8xDk0vP1255ZviwCL5lNNkrG48= X-Google-Smtp-Source: APXvYqxgG3E4dLwVhwCuNpoIGDEruwgJCfxAf540dPXbA2gJpqx9sJti1nderzcDF4noPcYd111apw== X-Received: by 2002:a63:c94f:: with SMTP id y15mr56277548pgg.159.1558879373952; Sun, 26 May 2019 07:02:53 -0700 (PDT) Received: from [192.168.20.22] (c-73-19-52-228.hsd1.wa.comcast.net. [73.19.52.228]) by smtp.gmail.com with ESMTPSA id p64sm9663278pfp.72.2019.05.26.07.02.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 26 May 2019 07:02:53 -0700 (PDT) Mime-Version: 1.0 (1.0) Subject: Re: svn commit: r348285 - projects/fuse2/tests/sys/fs/fusefs From: Enji Cooper X-Mailer: iPhone Mail (16F156) In-Reply-To: <201905260352.x4Q3qZBT010750@repo.freebsd.org> Date: Sun, 26 May 2019 07:02:52 -0700 Cc: src-committers@freebsd.org, svn-src-projects@freebsd.org Message-Id: <276AB18D-F1C7-47FF-B070-A019352FB615@gmail.com> References: <201905260352.x4Q3qZBT010750@repo.freebsd.org> To: Alan Somers X-Rspamd-Queue-Id: 1E7BF8860E X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-6.98 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; REPLY(-4.00)[]; NEURAL_HAM_SHORT(-0.98)[-0.980,0] Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 May 2019 14:02:56 -0000 > On May 25, 2019, at 20:52, Alan Somers wrote: >=20 > Author: asomers > Date: Sun May 26 03:52:35 2019 > New Revision: 348285 > URL: https://svnweb.freebsd.org/changeset/base/348285 >=20 > Log: > fusefs: more build fixes >=20 > * Fix printf format strings on 32-bit OSes > * Fix -Wclass-memaccess violation on GCC-8 caused by using memset on an o= bject > of non-trivial type. > * Fix memory leak in MockFS::init > * Fix -Wcast-align error on i386 in expect_readdir > * Fix some heterogenous comparison errors on 32-bit OSes. >=20 > Sponsored by: The FreeBSD Foundation >=20 > Modified: > projects/fuse2/tests/sys/fs/fusefs/mockfs.cc > projects/fuse2/tests/sys/fs/fusefs/mockfs.hh > projects/fuse2/tests/sys/fs/fusefs/read.cc > projects/fuse2/tests/sys/fs/fusefs/setattr.cc > projects/fuse2/tests/sys/fs/fusefs/utils.cc >=20 > Modified: projects/fuse2/tests/sys/fs/fusefs/mockfs.cc > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D > --- projects/fuse2/tests/sys/fs/fusefs/mockfs.cc Sat May 25 23:58:09 20= 19 (r348284) > +++ projects/fuse2/tests/sys/fs/fusefs/mockfs.cc Sun May 26 03:52:35 20= 19 (r348285) ... > - in =3D (mockfs_buf_in*) malloc(sizeof(*in)); > + in =3D new mockfs_buf_in; > ASSERT_TRUE(in !=3D NULL); > - out =3D (mockfs_buf_out*) malloc(sizeof(*out)); > + out =3D new mockfs_buf_out; > ASSERT_TRUE(out !=3D NULL); >=20 > read_request(in); > ASSERT_EQ(FUSE_INIT, in->header.opcode); >=20 > - memset(out, 0, sizeof(*out)); > out->header.unique =3D in->header.unique; > out->header.error =3D 0; > out->body.init.major =3D FUSE_KERNEL_VERSION; > @@ -418,7 +423,8 @@ void MockFS::init(uint32_t flags) { > SET_OUT_HEADER_LEN(out, init); > write(m_fuse_fd, out, out->header.len); >=20 > - free(in); > + delete out; > + delete in; Given that the tests are currently using C++14, it seems like it would make s= ense to use smart pointers here to manage the scope/lifetime of the objects,= as this could leak if someone added an early return or an exception was thr= own. Ref: https://en.cppreference.com/book/intro/smart_pointers. > } >=20 > void MockFS::kill_daemon() { >=20 > Modified: projects/fuse2/tests/sys/fs/fusefs/mockfs.hh > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D > --- projects/fuse2/tests/sys/fs/fusefs/mockfs.hh Sat May 25 23:58:09 20= 19 (r348284) > +++ projects/fuse2/tests/sys/fs/fusefs/mockfs.hh Sun May 26 03:52:35 20= 19 (r348285) > @@ -166,7 +166,7 @@ union fuse_payloads_out { > fuse_create_out create; > fuse_create_out_7_8 create_7_8; > /* The protocol places no limits on the size of bytes */ > - uint8_t bytes[0x20000]; > + uint8_t bytes[0x20000]; What does this hex value represent? Could it be made into a constant? ... > - cur_size =3D std::max(cur_size, > + cur_size =3D std::max((uint64_t)cur_size, > in->body.write.size + in->body.write.offset); > }))); Casting like this is legal, but this is the C way of doing casting. C++11 an= d newer recommends using static_cast for all compile time casting and dynami= c_cast for all runtime casting. Thanks :)! -Enji=