Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp491280imm; Fri, 3 Aug 2018 06:50:46 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdr2aSPKFsK4WPJGgEhuR1g4/w6aAL24d+Ohq1uEXzymLa/QijK0CyER4e0eTn6/+KtwqI9 X-Received: by 2002:a62:e18:: with SMTP id w24-v6mr4643207pfi.145.1533304246652; Fri, 03 Aug 2018 06:50:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533304246; cv=none; d=google.com; s=arc-20160816; b=qfRLvYq87ezuFZfy2pa7Q3ZRdDrsigyUe0k8K8xCKRjgSwGXnLVewjqS7fPQbSbdkw q4OkjrJK4ivMj70eXYTSpDum/nkFLu/7SpzAjypfQ32pSA4VE6kIrkhaQ8O20ODnIHpZ ICOkklq1iBjBDgiFK3CD/+7bkLA2DtHuKsb5LNiAlI4weVrPm2Tx6Ql8fwnLx/GgeF3f snYLKUpOkKYjZs/cUjWt4HyNOlZLsn4kcBhWRFfa0xv7OXjMyAPnIZMqqrfpCs0iy1W/ P8jdj438GktcksYjlLbvIwr41eZWY/WyuEPF82XV7UGMGwE+MjoAiRVVHmeHzto6tlgw s7pQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:content-id:mime-version :subject:cc:to:references:in-reply-to:from:organization :arc-authentication-results; bh=6OryUQB4kd7KvO0Kb3cF107R5HJtvg6kkBPcMBUb5bI=; b=M1eFKIzgO2JAUFwQixZN7iGfLEjt/2JBQqILmxJJbTic8rGNaexn0CZN+APYoEXH68 HCAuohNVktRnTKtetYgNTugcsfp/vEm0J/TYFQYLRRZ6M3UuWPL1c002JnJBaJfyk5Oi 18PTdXo0CDIsXmq4C+9z2Vo2EZChQhlRbn9yzi1sqTc0gqvqtGQv/FpzPNu28mk9Wday rqVYZSYVqi8zuiSfXCYyX1inCmBPsqZhoyRiyan2PPZiagtS/GNcjEPZHstOolmnhAu5 sqqBBfHIP5IQr5CPSjACV/XgVSmGm/nrOgdvakdTBVKlOa0RN1D5ZRcyFJaxvGwmd2A0 gnZA== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w9-v6si3602046plp.395.2018.08.03.06.50.31; Fri, 03 Aug 2018 06:50:46 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732209AbeHCPqA (ORCPT + 99 others); Fri, 3 Aug 2018 11:46:00 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:59018 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729985AbeHCPqA (ORCPT ); Fri, 3 Aug 2018 11:46:00 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id CC08F401DE61; Fri, 3 Aug 2018 13:49:33 +0000 (UTC) Received: from warthog.procyon.org.uk (ovpn-120-78.rdu2.redhat.com [10.10.120.78]) by smtp.corp.redhat.com (Postfix) with ESMTP id C1DA21D080; Fri, 3 Aug 2018 13:49:30 +0000 (UTC) Organization: Red Hat UK Ltd. Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SI4 1TE, United Kingdom. Registered in England and Wales under Company Registration No. 3798903 From: David Howells In-Reply-To: <20180722110519.23917-1-tomasbortoli@gmail.com> References: <20180722110519.23917-1-tomasbortoli@gmail.com> To: Tomas Bortoli Cc: dhowells@redhat.com, linux-cachefs@redhat.com, linux-kernel@vger.kernel.org, syzkaller@googlegroups.com Subject: Re: [PATCH] fscache: fscache_set_key() - align alloc and usage MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <17156.1533304170.1@warthog.procyon.org.uk> Date: Fri, 03 Aug 2018 14:49:30 +0100 Message-ID: <17157.1533304170@warthog.procyon.org.uk> X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Fri, 03 Aug 2018 13:49:33 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Fri, 03 Aug 2018 13:49:33 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'dhowells@redhat.com' RCPT:'' Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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