Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp3082798imm; Sun, 1 Jul 2018 11:53:07 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJs3NDVuDjpey6dskLR2wvVvUsMYzhgj4J5wb0ms9YZ5/uW9Nx27xYWv9CFAghsnSUtY8Dy X-Received: by 2002:a17:902:aa48:: with SMTP id c8-v6mr23033058plr.132.1530471187409; Sun, 01 Jul 2018 11:53:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530471187; cv=none; d=google.com; s=arc-20160816; b=FKt5uLCku5xw+9F3uv3lxhSUQghFC2oCQ+hkkDgISY3cQnnfJBDrWcRziNZBz4lDdQ AfHvgM7UkdDrZDJRDsqbuzmzseG8R+51lIQ+n27iZE1NDNDcRQY9x78KvDeeiZ1KFO6w /U/ssTkcBNxwOOtl72dDsRQ15RqKr4t4F/gilaok/nWgNQZECa9Q5CjNK0guVtnNRGcx Tg0YDosHll9JOYi6AZeJB/iouCqkEo3OLCABOnx6lTE6hZNJ8X5CuUQoUv6mYVfB0NSd cyGNpLn4cfs+M4v+YgVkrBCCmEJNxHoy60O1wv8E6AG3vlRyC9pBbW8NZzJr1PaHmGZT aY+w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date :arc-authentication-results; bh=owaUluNYrcc7rFYEuxuSxeGo39rsCAXGHKGFpEu19as=; b=tQprleaPwI8KMIGFpSaAZq/Gq60GGAmG0iSFKbVGgfdqRP1f+ML092ODL8c/gnzdTV MiDdwFPQRFfsyHJ8FoRcFfYQGJkTB9fwutXJCSFMxFppSkFea53fPBRY9ckfW+2Ug8+O O+twJJROjUsaCD0gSqli4FxXCpl/OhyA8Pa16DwiNEAMUlPh1YwvFwQhPwu7okAQHUMW KMzGD1SwK8JfozbzmF/fYP8hrBOHv32KIoHCsPYDEwLEYBxgJ+2T5tr0c6AX1OaS7JEo yFFmy8ZlSuDw7Y4PkevyjnwmkoSykSSwpxxzOy+Vpfq74GSUlcpy2Mn1SuQXtLstYpvb 2jMQ== ARC-Authentication-Results: i=1; mx.google.com; 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 195-v6si12152499pgb.176.2018.07.01.11.52.52; Sun, 01 Jul 2018 11:53:07 -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; 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 S1752560AbeGASwP (ORCPT + 99 others); Sun, 1 Jul 2018 14:52:15 -0400 Received: from mail3-relais-sop.national.inria.fr ([192.134.164.104]:47114 "EHLO mail3-relais-sop.national.inria.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752328AbeGASwN (ORCPT ); Sun, 1 Jul 2018 14:52:13 -0400 X-IronPort-AV: E=Sophos;i="5.51,295,1526335200"; d="scan'208";a="271085121" Received: from 89-157-201-3.rev.numericable.fr (HELO [192.168.0.15]) ([89.157.201.3]) by mail3-relais-sop.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 01 Jul 2018 20:51:55 +0200 Date: Sun, 1 Jul 2018 20:51:55 +0200 (CEST) From: Julia Lawall X-X-Sender: jll@hadrien To: Joe Perches cc: linux-usb@vger.kernel.org, Chengguang Xu , kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org, linux-input@vger.kernel.org, linux-media@vger.kernel.org Subject: Re: [PATCH 0/3] cast sizeof to int for comparison In-Reply-To: <653914f26dc8433a3f682b5e7eb850ab94bd431d.camel@perches.com> Message-ID: References: <1530466325-1678-1-git-send-email-Julia.Lawall@lip6.fr> <653914f26dc8433a3f682b5e7eb850ab94bd431d.camel@perches.com> User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, 1 Jul 2018, Joe Perches wrote: > On Sun, 2018-07-01 at 19:32 +0200, Julia Lawall wrote: > > Comparing an int to a size, which is unsigned, causes the int to become > > unsigned, giving the wrong result. > > > > The semantic match that finds this problem is as follows: > > (http://coccinelle.lip6.fr/) > > Great, thanks. > > But what about the ones in net/smc like: > > > net/smc/smc_clc.c: > > > > len = kernel_sendmsg(smc->clcsock, &msg, &vec, 1, > > sizeof(struct smc_clc_msg_decline)); > > if (len < sizeof(struct smc_clc_msg_decline)) > > Are those detected by the semantic match and ignored? I wasn't sure how to justify that kernel_sendmsg returns a negative value. If it is the case, I can send the patch. I only found this in one file, but there were multiple occurrences. julia