Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp347672ybh; Sun, 12 Jul 2020 08:15:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwca8cH7g+V57LDIZ9rrxcB5gJ1uC4xEQzHzxZLRjA06iLxDVSzmsM/eUEBjAMzylgKLQN+ X-Received: by 2002:aa7:d88e:: with SMTP id u14mr71985437edq.11.1594566957799; Sun, 12 Jul 2020 08:15:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594566957; cv=none; d=google.com; s=arc-20160816; b=MF97/c6Lg1DgLs/jvlLX15NkoGHU+s47HeUD/6WM2iIQ94oMyNQnnt1q2pn0ga84re YklNJiSOXPypIZxjYEB76N64mh+RTpqYS/SWxygM5FE4z3v1xt5mYSP5343syJ/DUteQ R2LygMBwOVomRsqywrf3OztNSz+kI44XyF6VTobynWy5bdVbCoU7GKs/XoPUgHADmOLQ A/a2twBOmH/QSjftYTEIyAqwH6fw3fzQIndrdw1UhrKBoO4e5I7BmLUHlE2r4uaZhSFl 5L+kqN9ec2lyN8ISXFK8cJi+Go0FJUEkz4NwZg03VpXrEcSjZ9OFy1EMTECTLifkfSXq nksA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=NZm5xGXGIsTfeQaPHTSVnSl1UUxikxu7jO8zjXTvbMg=; b=THB3/GslazIcZCOvXGOfhWn8HLoHTJtqp85/uyHCgf0Wj+FlevfLGeigQJ4o28slg1 mVikcpiStoImMSM5x9pDFLPrxoTWczz64G4erabsWw3AKcop/TOcSZOAZs3jUILJUyKR YyS8xRHSV/BebmyFuNh5WV70MyIAlaqagQwhgqoBhOxRtxfRJ7nzLgnOQY1BbM2CUz3f UBbkAtl7+zNYXTNJbwnA00AYARYAE1+kTdQvLjqHNNsf7Q5TGczqVOHYMpCOuvCPJO9i YBQ+HTrK8V6IViOm3quKUFrHEb28zC2pBjvp5qWjG+LtntTze0IjfrVJJmqTJ4LCjs3K eTag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=cuQvyvS6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id du14si8794373ejc.721.2020.07.12.08.15.34; Sun, 12 Jul 2020 08:15:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=cuQvyvS6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728979AbgGLPM6 (ORCPT + 99 others); Sun, 12 Jul 2020 11:12:58 -0400 Received: from us-smtp-2.mimecast.com ([207.211.31.81]:42887 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728826AbgGLPMy (ORCPT ); Sun, 12 Jul 2020 11:12:54 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1594566773; h=from:from: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=NZm5xGXGIsTfeQaPHTSVnSl1UUxikxu7jO8zjXTvbMg=; b=cuQvyvS6BWuqK0RnGKNQa7kveYINSiL6M1PYtPrxZbLYzfNL/TiKrWGGEyxqMCP1FSG6gV eg7sC9ZHdJz+o5F2K5CBd3Nqy040tOVx/UYrHFZh3t3kFtLPkRNhPHhl4A8OXnwSApgJCn 5KEVcE5QQgf4NjSX/1hFi5nnWOtGyDo= Received: from mail-qt1-f199.google.com (mail-qt1-f199.google.com [209.85.160.199]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-199-TQxMkJo3NNCS6wrenqPZwg-1; Sun, 12 Jul 2020 11:12:47 -0400 X-MC-Unique: TQxMkJo3NNCS6wrenqPZwg-1 Received: by mail-qt1-f199.google.com with SMTP id x6so8325728qtf.2 for ; Sun, 12 Jul 2020 08:12:46 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=NZm5xGXGIsTfeQaPHTSVnSl1UUxikxu7jO8zjXTvbMg=; b=ZnOfvsUv4xFUKoTl+09J/13t0b3GMc+3clQ9THU1YKf+8yrBdRpoojGRBL9eGa3Olk fN5ZIJDV8RFvhEgOcl1/VscUyt807p7TRCYGEiTomaRPPMTqdmrAoT9ofM+dGBFAnwhh /epjzQkaf8adP/Ugp2aUmEZH03O2UQhLtzeBujIY6ojlLvJZh5UNb9r9z3dglm84BT7v WNMkkNi6o7GWtMLVvnrBrDFLal5hemMj6YOMKxervZobTUdWIxAV9NQ99FWZ/HIHX9H7 6ZpFUGOfbP49DByWc7tdMDwv1DftqQ50cIUoWwOAbdapHJHbaEwQBipAfyjA25tBodf0 ZZyA== X-Gm-Message-State: AOAM5306dwHAvhObmNDFYpfSpcurUAt2IMNwSP771v9v4RFVo4fN0uwA D4YrpTNvk9utdG/nYQFVJBVuPU5LoDVxMU/nGoSk5GIjHZbqsCbZJC7xvxfye2eo5dilyC0klaP ICdL9Mqy835g8JuQs4u/vzI5g X-Received: by 2002:a0c:8b4a:: with SMTP id d10mr75669743qvc.31.1594566766118; Sun, 12 Jul 2020 08:12:46 -0700 (PDT) X-Received: by 2002:a0c:8b4a:: with SMTP id d10mr75669730qvc.31.1594566765897; Sun, 12 Jul 2020 08:12:45 -0700 (PDT) Received: from trix.remote.csb (075-142-250-213.res.spectrum.com. [75.142.250.213]) by smtp.gmail.com with ESMTPSA id 23sm14431251qkl.52.2020.07.12.08.12.44 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 12 Jul 2020 08:12:44 -0700 (PDT) Subject: Re: [PATCH] decompress_bunzip2: fix sizeof type in start_bunzip To: "H. Peter Anvin" , alain@knaff.lu Cc: linux-kernel@vger.kernel.org, stable@vger.kernel.org References: <20200712125952.8809-1-trix@redhat.com> <639c8ef5-2755-7172-fbb8-ce45c8637feb@zytor.com> From: Tom Rix Message-ID: <9af191c2-0f2c-7637-433a-b557a07590ca@redhat.com> Date: Sun, 12 Jul 2020 08:12:43 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.6.0 MIME-Version: 1.0 In-Reply-To: <639c8ef5-2755-7172-fbb8-ce45c8637feb@zytor.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 7/12/20 6:09 AM, H. Peter Anvin wrote: > On 2020-07-12 05:59, trix@redhat.com wrote: >> From: Tom Rix >> >> clang static analysis flags this error >> >> lib/decompress_bunzip2.c:671:13: warning: Result of 'malloc' is converted >> to a pointer of type 'unsigned int', which is incompatible with sizeof >> operand type 'int' [unix.MallocSizeof] >> bd->dbuf = large_malloc(bd->dbufSize * sizeof(int)); >> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ >> >> Reviewing the bunzip_data structure, the element dbuf is type >> >> /* Intermediate buffer and its size (in bytes) */ >> unsigned int *dbuf, dbufSize; >> >> So change the type in sizeof to 'unsigned int' >> > You must be kidding. > > If you want to change it, change it to sizeof(bd->dbuf) instead, but this flag > is at least in my opinion a total joke. For sizeof(int) != sizeof(unsigned > int) is beyond bizarre, no matter how stupid the platform. Using the actual type is more correct that using a type of the same size. trix > -hpa >