From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 73811C43142 for ; Sun, 24 Jun 2018 07:46:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3199624E31 for ; Sun, 24 Jun 2018 07:46:27 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3199624E31 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.de Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751699AbeFXHqY (ORCPT ); Sun, 24 Jun 2018 03:46:24 -0400 Received: from mx2.suse.de ([195.135.220.15]:45372 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751323AbeFXHqX (ORCPT ); Sun, 24 Jun 2018 03:46:23 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (charybdis-ext-too.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 92966AE80; Sun, 24 Jun 2018 07:46:22 +0000 (UTC) Date: Sun, 24 Jun 2018 09:46:21 +0200 Message-ID: From: Takashi Iwai To: air icy Cc: alsa-devel@alsa-project.org, perex@perex.cz, linux-kernel@vger.kernel.org Subject: Re: UBSAN: Undefined behaviour in sound/core/timer.c In-Reply-To: References: User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL/10.8 Emacs/25.3 (x86_64-suse-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") 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, 24 Jun 2018 09:11:42 +0200, air icy wrote: > > Hi Takashi, > > You are a responsible man. > I repro this bug in *https://github.com/lcytxw/bug_repro/tree/master/bug_200213 > * > This patch is ok since I can't repro this bug anymore. Good to hear. Would you like put your reported-by and tested-by tags? If yes, please give it explicitly. It's be better to give a real name than a nick name there in general. Oh, and your another report for seq_client.c should be handled similarly, a patch like below. Please give it a try. thanks, Takashi --- --- a/sound/core/seq/seq_clientmgr.c +++ b/sound/core/seq/seq_clientmgr.c @@ -2004,7 +2004,8 @@ static int snd_seq_ioctl_query_next_client(struct snd_seq_client *client, struct snd_seq_client *cptr = NULL; /* search for next client */ - info->client++; + if (info->client < INT_MAX) + info->client++; if (info->client < 0) info->client = 0; for (; info->client < SNDRV_SEQ_MAX_CLIENTS; info->client++) {