Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp728535imm; Fri, 3 Aug 2018 10:28:25 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfltJjwBJL9mZrYJOliFOBacRXcpD6qYYH/1vpcHH1iSxTDf9R0W7CgFbqcNjY0rDT/F8Ta X-Received: by 2002:a17:902:7896:: with SMTP id q22-v6mr4418570pll.47.1533317305507; Fri, 03 Aug 2018 10:28:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533317305; cv=none; d=google.com; s=arc-20160816; b=ED83W7XVQWWZ7Nz10sCIHNJPsAvdhs0mYiQCrGUe9KOUGOhV2Of9jlxDBZwEVU0G/I 6P+Ow7CGfxKmzdHKF0TiH5Ou78nJJq4GIFeHYI5pUyuzn/ltK3pns3aBJCnI4Xz0oY9k ryCL5OX33rukZkVe+pGDPi/fAW3QZbleN/NDDtRsRDxhKfaRQ+6/ceK9SiEMmD7pYrnq 3fD8SJ6SYDdrvKQ8s5Ddby+SB6XJbX6EByRC/OwnjqI/W3yphelUo+eY45fimw88kuFS MjqebHuQHGTCBzwcjzaixNzjN4qxl6cJAk6QZFwwpugYipArVdpPpU828N3+d0KO00+5 D0Ew== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:autocrypt:openpgp:from:references:cc:to:subject :dkim-signature:arc-authentication-results; bh=6PD9xbnGhe9f8WodG9QOPgzPVA+d8Rftq5cwASjVC/Y=; b=l3Vudvvm56P0fFYvEs+Fg8W3i6NSVRrt6gZAQYZD2/IWFbz4l8wUDpvXghccIEoV2o MjnvMIIuhXJrpMDSDGjKpOv15EpRnpXAhcmzpWGyXU5PcWjC55Qir+vI3YRs5y94C9Xi nb5HKbr+EnLKqg7sDOeqe7G9vfjYur9gRTWYP70sTa9OmMpSPJhg6lGqbh1WaPpxGqav lv//rJOAkiCO0a6LNfK/cW4fvpzwpvKA3+LuhvQY5/JJn2V2lrFIgyYD31u0DbBMt2iM uO+JQRoHyDakq0hnjOg0HKBVy+wM+mdXgESa3loBkZe9gvWrKQcUrliOHM/xdXeb/HbB Niew== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=oCCFtpqt; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v12-v6si3811689plz.105.2018.08.03.10.28.10; Fri, 03 Aug 2018 10:28:25 -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=pass header.i=@gmail.com header.s=20161025 header.b=oCCFtpqt; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730588AbeHCTXZ (ORCPT + 99 others); Fri, 3 Aug 2018 15:23:25 -0400 Received: from mail-lj1-f196.google.com ([209.85.208.196]:35676 "EHLO mail-lj1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728872AbeHCTXZ (ORCPT ); Fri, 3 Aug 2018 15:23:25 -0400 Received: by mail-lj1-f196.google.com with SMTP id p10-v6so5566076ljg.2 for ; Fri, 03 Aug 2018 10:26:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:openpgp:autocrypt:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=6PD9xbnGhe9f8WodG9QOPgzPVA+d8Rftq5cwASjVC/Y=; b=oCCFtpqtTNwuAd9zV6rmVzqdXLP6M/P1rxTpFNChTYaai9iVCGn8LJaYtZaXUEIuFa 8nZ28D22sxl1ZyTi3JUx/harwFLtARsr8xGEcd1S7mI1YfXJNWRGn5t5JFO0cXCxLFaF bug7OWI3SE7iXDHwYXsAijAAU8i8WQlZ2KSGxzu1syBsHf7DXClQcjrBk/uP91aM1vS6 cRidWAsUrwSMdYiObCHGGzLVaHDI4NJlI+wRGZCklXpu9qFZ5LuUXun+mGADpnovLooC PaJ/AMdlbVnLWibYJuseksBQwI1ymJPzN6vsm+1gGGlKAt+DZ0GGHOKYqr7UzLcsQect ymaQ== 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:openpgp:autocrypt :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=6PD9xbnGhe9f8WodG9QOPgzPVA+d8Rftq5cwASjVC/Y=; b=rtDP0BNLdLX5cRNqfJ/AnOjECIZy7NvtQuiqLiddLnKCJCMtBfLmxWAcgA8fn+6+F0 hVbzaT6HRBUjzIVAyPdw2pv3tpG/Leb5AHkRtuKLG5oEq6kVgrWZJJvgKVjNflWVXcSC YfZPB4n2XNRN98TcXkHDwEYjNZRvxmRKZ0kyDFV1CpuH42AZxmfKyy4h4YFvETDZcQN8 ZbXo3546P1mP0379nCRV9c2gDJHDKVMmpnG6T71NDCY7OFC95oiprBcfz8mISZn6rXzJ JehAemS9wNycn2vsZQUwtjRcCHLCOeGMFxVZvR5pkCMjUyAACmWd4jboLhLtauYeTaBN wLdA== X-Gm-Message-State: AOUpUlHkTlWOj6petrhZpKwW3mlbKr62MdObrIABeP9ee7daec2OHeua NfjNQhxLQj1RRCnk1/u+Fjw= X-Received: by 2002:a2e:4401:: with SMTP id r1-v6mr6419781lja.21.1533317169314; Fri, 03 Aug 2018 10:26:09 -0700 (PDT) Received: from ?IPv6:2001:2012:22e:1b00:f2e2:9015:9262:3fde? ([2001:2012:22e:1b00:f2e2:9015:9262:3fde]) by smtp.gmail.com with ESMTPSA id x3-v6sm986463ljb.25.2018.08.03.10.26.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 03 Aug 2018 10:26:08 -0700 (PDT) Subject: Re: [PATCH] fscache: fscache_set_key() - align alloc and usage To: David Howells Cc: linux-cachefs@redhat.com, linux-kernel@vger.kernel.org, syzkaller@googlegroups.com References: <20180722110519.23917-1-tomasbortoli@gmail.com> <17157.1533304170@warthog.procyon.org.uk> From: Tomas Bortoli Openpgp: preference=signencrypt Autocrypt: addr=tomasbortoli@gmail.com; prefer-encrypt=mutual; keydata= xsFNBFpCTZMBEADNZ1+Ibh0Z4pgGRcd1aOUMbe/YfHktmajjcoTnKmZZunjoUVAl8waeLITd BC2c8i1wHzHcnthrmb1izs5XlG6PZnl8n5tjysSNbwggzS1NcEK1qgn5VjNlHQ5aRMUwCC51 kicBiNmlQk2UuzzWwdheRGnaf+O1MNhC0GBeEDKQAL5obOU92pzflv6wWNACr+lHxdnpyies mOnRMjH16NjuTkrGbEmJe+MKp0qbjvR3R/dmFC1wczniRMQmV5w3MZ/N9wRappE+Atc1fOM+ wP7AWNuPvrKg4bN5uqKZLDFH7OFpxvjgVdWM40n0cQfqElWY9as+228Sltdd1XyHtUWRF2VW O1l5L0kX0+7+B5k/fpLhXqD3Z7DK7wRXpXmY59pofk7aFdcN97ZK+r6R7mqrwX4W9IpsPhkT kUyg3/Dx/khBZlJKFoUP325/hoH684bSiPEBroel9alB7gTq2ueoFwy6R3q5CMUw3D+CZWHA 3xllu46TRQ/Vt2g0cIHQNPoye2OWYFJ6kSEvaLpymjNDJ9ph2EuHegonDfOaYSq34ic2BcdB JkCgXRLP5K7KtRNJqqR+DM8xByeGmQv9yp6S97el+SiM9R53RhHawJZGz0E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PyJo54MW39wGjfC2+PM5I0xebbxtnuTewRchVVfm7UWgLAy11pV3xM4wMSJOuqVMOz jYpWKYxDTpvsZ0ginUUY993Gb8k/CxjABEMUGVHhQPZ0OzjHIKS6cTzN6ue8bB+CGOLCaQp1 C0NRT5Tn9zpLxtf5nBExFd/zVENY5vAV2ZbKQdemO54O7j6B9DSgVRrm83GCZxbL4d+qTYBF 3tSCWw/6SG1F3q9gR9QrSC2YRjCmhijUVEh6FhZwB58TNZ1sEEttrps8TDa5tUd9 Message-ID: <235fd31a-b20a-58e1-1cb9-0b0e02fce415@gmail.com> Date: Fri, 3 Aug 2018 19:26:07 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <17157.1533304170@warthog.procyon.org.uk> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 08/03/2018 03:49 PM, David Howells wrote: > Tomas Bortoli wrote: > >> The fscache_set_key() function allocates the buf pointer if index_key_len > >> sizeof(cookie->inline_key). In such cases the allocated space might not be >> aligned with the pointer type. This may result in an out-of-bound in the >> for-loop later in the same function, as the counter is rounded up. > > Yeah, it's good idea anyway since I should tell the allocator everything that > I expect to use - though kmalloc() will effectively rounds up the size to a > multiple of 8 anyway (ie. the smallest allocation granule is 8 bytes). > > David > Yeah I forgot that :) at least KASAN won't complain anymore. Tomas