From mboxrd@z Thu Jan 1 00:00:00 1970 From: Panu Matilainen Subject: Re: [PATCH 5/5] Fix usage of fgets in various places Date: Tue, 24 Feb 2015 11:20:33 +0200 Message-ID: <54EC4261.6050804@redhat.com> References: <1424700600-1765-1-git-send-email-pawelx.wodkowski@intel.com> <1424700600-1765-6-git-send-email-pawelx.wodkowski@intel.com> <20150223080035.001417e8@urahara> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Cc: dev-VfR2kkLFssw@public.gmane.org To: Stephen Hemminger , Pawel Wodkowski Return-path: In-Reply-To: <20150223080035.001417e8@urahara> List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces-VfR2kkLFssw@public.gmane.org Sender: "dev" On 02/23/2015 06:00 PM, Stephen Hemminger wrote: > On Mon, 23 Feb 2015 15:10:00 +0100 > Pawel Wodkowski wrote: > >> Declaration of fgets() is >> char *fgets(char *str, int size, FILE *stream); >> >> Klocwork complain about passing "sizeof()" as size parameter since >> implicit casting size_t to int might cause loss of precision. >> >> Signed-off-by: Pawel Wodkowski > > NAK this is shooting at Unicorns. > The tool is the problem not the code. The tool is technically correct, even if loss of precision might be unlikely to occur in this context. However the patch is incorrect, the problem doesn't go away by adding an explict cast even if it shuts up the tool. - Panu -