Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp4391731yba; Sun, 12 May 2019 11:46:38 -0700 (PDT) X-Google-Smtp-Source: APXvYqwUBpVdPUrO6Xc1u3bxjCiffJZiGtUa2OLql4hmcYGmCxgfleX7ncra4lNNNGjtH83EFB1l X-Received: by 2002:a62:ee04:: with SMTP id e4mr28460050pfi.232.1557686798669; Sun, 12 May 2019 11:46:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557686798; cv=none; d=google.com; s=arc-20160816; b=UtlECfMvjw2APGhUUrfeYESc3PGQTsb73ohpnUnyvMlGWXx1DhdvLj+JLZ3Od0/NUS eUSL5svYX/VUA3vMrbkhniagnb77q4lDVIkFYgg/PWZbMCRjufqXs+za5H5qTm8uFVi9 l70gfL5o4kEyTkChXYXFnQQFXpO1EXI0J301+tqEGIHwUrDQjFexT7VoahQKKhhAfYGk HYomrSxo+jMHN6c3AG5MjR61Ub06V5INe0sSeMy4Twm+aAfv9iW7flyHpb9BGIkot0SJ peOAU4bXbU7Y0MWJ9UKLWvoY4LXUZoYKO8Tsm6wt+zq6Vjb/JM5Z47dV9rTqWxluwY4O IpiQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:in-reply-to :references:subject:cc:to:mime-version:user-agent:reply-to:from:date :message-id:dkim-signature; bh=otGbpeOBUxPubh373VfctsNYuIcg2bUblAv6dqaMf+U=; b=ENiKLORdYnIp4vZtgXVaTKVf1y+ki68Owe5Rh/gZ6vdUa4zUE/XD6MLSR0FNvEyNPt UaEpi65s/bDhs+6MNo/tLu4INIxT2zq2nTlQmHlZxp8+MJnGljn+L3h9XrdqKDGrN20q GNyrPNDmAWIcExJQ/+TSM6D/Q4eYjCHHsYjVUH3nyAjkkd0HMoWRMbZMS64Filk012fd Xs965ykEBO7MYhZxSa1TWG3uElsINNrEfaNuQjN4yagSnH5anduzw8jmaXCbneh7LhVm linMc7xZPkBTBV/I0phjEkAzNr0en4Gmr97FfrmOo9F7jUgQkQKI4/rMkimox897C/uP 8CAQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@bfs.de header.s=dkim201901 header.b=Zi0SN6eD; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 65si13428591plf.2.2019.05.12.11.46.22; Sun, 12 May 2019 11:46:38 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@bfs.de header.s=dkim201901 header.b=Zi0SN6eD; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726997AbfELSoT (ORCPT + 99 others); Sun, 12 May 2019 14:44:19 -0400 Received: from mx01-fr.bfs.de ([193.174.231.67]:60694 "EHLO mx01-fr.bfs.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726695AbfELSoS (ORCPT ); Sun, 12 May 2019 14:44:18 -0400 Received: from mail-fr.bfs.de (mail-fr.bfs.de [10.177.18.200]) by mx01-fr.bfs.de (Postfix) with ESMTPS id 1A78220366; Sun, 12 May 2019 20:44:12 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bfs.de; s=dkim201901; t=1557686652; h=from:from:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=otGbpeOBUxPubh373VfctsNYuIcg2bUblAv6dqaMf+U=; b=Zi0SN6eD6GaX54lrqv1SUnB2TXa1kiIxMJbfaWBuWg9lMTdFZYu+54FfVG1WP9YeLgs6gg ds84cy9FxPewKnawtYrFvAkrGVaU1nviZz8yEw9g/7gNv72YN+u8/dsG4AXuflBA4yLETz SSjWvHN84sshvI9FqFOVvrFgiqCXWDH+sVWckJ1AITC2bsKNm0YYuKWMlG7d0VE2wwAcUF WRbOm2bkKYuWFuPCXz/YJE/IQAAd2x9SqZ5PEZYE/Qz9ZldGnzP0UzqIT9MoUX3yOoLjQD Hh/WzeKpFBHv9AZ8tPZI2B9USzAGTwZIqj6kaTsyuKspwii2Bmgcx7+dfoftAQ== Received: from [134.92.181.33] (unknown [134.92.181.33]) by mail-fr.bfs.de (Postfix) with ESMTPS id 99460BEEBD; Sun, 12 May 2019 20:44:11 +0200 (CEST) Message-ID: <5CD8697B.6010004@bfs.de> Date: Sun, 12 May 2019 20:44:11 +0200 From: walter harms Reply-To: wharms@bfs.de User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; de; rv:1.9.1.16) Gecko/20101125 SUSE/3.0.11 Thunderbird/3.0.11 MIME-Version: 1.0 To: David Howells CC: colin.king@canonical.com, joe@perches.com, jaltman@auristor.com, linux-afs@lists.infradead.org, kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 2/2] afs: Fix afs_xattr_get_yfs() to not try freeing an error value References: <5CD844B0.5060206@bfs.de> <155764714099.24080.1233326575922058381.stgit@warthog.procyon.org.uk> <155764714872.24080.15171754166782593095.stgit@warthog.procyon.org.uk> <31808.1557684645@warthog.procyon.org.uk> In-Reply-To: <31808.1557684645@warthog.procyon.org.uk> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-3.10 Authentication-Results: mx01-fr.bfs.de X-Spamd-Result: default: False [-3.10 / 7.00]; HAS_REPLYTO(0.00)[wharms@bfs.de]; TO_DN_SOME(0.00)[]; REPLYTO_ADDR_EQ_FROM(0.00)[]; RCPT_COUNT_SEVEN(0.00)[7]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; MID_RHS_MATCH_FROM(0.00)[]; BAYES_HAM(-3.00)[100.00%]; ARC_NA(0.00)[]; FROM_HAS_DN(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; DKIM_SIGNED(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[] Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Am 12.05.2019 20:10, schrieb David Howells: > walter harms wrote: > >>> + ret = dsize; >>> + if (size > 0) { >>> + if (dsize > size) { >>> + ret = -ERANGE; >>> + goto error_key; >>> } >>> + memcpy(buffer, data, dsize); >>> } >>> >> >> i am confused: if size is <= 0 then the error is in dsize ? > > See this bit, before that hunk: > >> + if (ret < 0) >> + goto error_key; > > David > Sorry, you misunderstood me, my fault, i did not see that size is unsigned. NTL i do not think size=0 is useful. You get size from outside, and if i follow the flow correct the first use of it is to check size>0. perhaps you can check size at start and simply return. Now if size==0 it will return dsize and give the impression that buffer is used (it is not). while you are there: flags |= YFS_ACL_WANT_ACL is always flags = YFS_ACL_WANT_ACL; since flags is 0 at this point. IMHO that sould be moved to the strcmp() section. hope that helps, re, wh