From owner-svn-src-head@FreeBSD.ORG Tue May 6 14:08:01 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 40779A13; Tue, 6 May 2014 14:08:01 +0000 (UTC) Received: from mail-qg0-x231.google.com (mail-qg0-x231.google.com [IPv6:2607:f8b0:400d:c04::231]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C441F378; Tue, 6 May 2014 14:08:00 +0000 (UTC) Received: by mail-qg0-f49.google.com with SMTP id a108so2671285qge.8 for ; Tue, 06 May 2014 07:08:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=0NL2Y4/k0Y1LIRtg/4G+SR6+daha3oszg+yHNW6qMUU=; b=pBQGSwWCvbOqwQGjti0Tn7mJYAaHmSHBBMmrkCj5zPCMYttOyNJHVLw7/8iMdSn+Mx 2FlhZb6h3+tAZd3vF/ERvcneJetCw4nPQmL58imMckC24X0Qtv13N6v+smkWFZVelTJs kTZ8rId841OVSMwLAcpzH46bAQBKX5PG9OT3Re7+FDQPqAsxc9W6T2SZMkuSfhbAzy7B KpcFx4apTWYAGaduka0tAQAb9ZNtfzKCllymkqPd6aIVbwSdj29Rs5nW98tfEXDq4w3/ t7HnWa64HUxi9FyOChR8SLInwiDpHmy1/ttRUQYZGOou8x7C84r3S4JuG872OcBDdwGo DhZQ== MIME-Version: 1.0 X-Received: by 10.224.6.10 with SMTP id 10mr55877414qax.45.1399385279863; Tue, 06 May 2014 07:07:59 -0700 (PDT) Sender: mdf356@gmail.com Received: by 10.229.170.195 with HTTP; Tue, 6 May 2014 07:07:59 -0700 (PDT) In-Reply-To: <201405061352.s46DqE9a025250@svn.freebsd.org> References: <201405061352.s46DqE9a025250@svn.freebsd.org> Date: Tue, 6 May 2014 07:07:59 -0700 X-Google-Sender-Auth: YMuqKuTwxkMjoJBmLnLfcTx9t1A Message-ID: Subject: Re: svn commit: r265442 - head/sys/dev/vt From: Matthew Fleming To: Aleksandr Rybalko Content-Type: text/plain; charset=UTF-8 Cc: "svn-src-head@freebsd.org" , "svn-src-all@freebsd.org" , "src-committers@freebsd.org" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 May 2014 14:08:01 -0000 On Tue, May 6, 2014 at 6:52 AM, Aleksandr Rybalko wrote: > Author: ray > Date: Tue May 6 13:52:13 2014 > New Revision: 265442 > URL: http://svnweb.freebsd.org/changeset/base/265442 > > Log: > Implement KDMKTONE ioctl. > > Submitted by: Matthew D.Fuller (original version) > MFC: 7 days > PR: kern/189170 > > Sponsored by: The FreeBSD Foundation > > Modified: > head/sys/dev/vt/vt_core.c > > Modified: head/sys/dev/vt/vt_core.c > ============================================================================== > --- head/sys/dev/vt/vt_core.c Tue May 6 13:46:36 2014 (r265441) > +++ head/sys/dev/vt/vt_core.c Tue May 6 13:52:13 2014 (r265442) > @@ -1732,9 +1732,17 @@ skip_thunk: > td->td_frame->tf_rflags &= ~PSL_IOPL; > #endif > return (0); > - case KDMKTONE: /* sound the bell */ > - /* TODO */ > + case KDMKTONE: { /* sound the bell */ > + int freq, period; > + > + freq = 1193182 / ((*(int*)data) & 0xffff); This data comes from a user and can't be trusted. This is a potential divide-by-zero. > + period = (((*(int*)data)>>16) & 0xffff) * hz / 1000; This is signed shift which I can't recall if it's well-defined if the number is negative. Using u_int would definitely be defined. Thanks, matthew