Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 12 Jul 2020 07:42:21 +0000 (UTC)
From:      Michal Meloun <mmel@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r363122 - head/sys/dev/extres/clk
Message-ID:  <202007120742.06C7gL68047268@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mmel
Date: Sun Jul 12 07:42:21 2020
New Revision: 363122
URL: https://svnweb.freebsd.org/changeset/base/363122

Log:
   Assigned clocks: fix off-by-one bug, don't leak allocated memory.
  
   MFC after:	1 week

Modified:
  head/sys/dev/extres/clk/clk.c

Modified: head/sys/dev/extres/clk/clk.c
==============================================================================
--- head/sys/dev/extres/clk/clk.c	Sun Jul 12 07:27:21 2020	(r363121)
+++ head/sys/dev/extres/clk/clk.c	Sun Jul 12 07:42:21 2020	(r363122)
@@ -1420,15 +1420,17 @@ clk_set_assigned(device_t dev, phandle_t node)
 		}
 
 		/* First set it's parent if needed */
-		if (i <= nparents)
+		if (i < nparents)
 			clk_set_assigned_parent(dev, clk, i);
 
 		/* Then set a new frequency */
-		if (i <= nrates && rates[i] != 0)
+		if (i < nrates && rates[i] != 0)
 			clk_set_assigned_rates(dev, clk, rates[i]);
 
 		clk_release(clk);
 	}
+	if (rates != NULL)
+		OF_prop_free(rates);
 
 	return (0);
 }



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202007120742.06C7gL68047268>